18 #ifndef ION_BASE_CALLLIST_H_
19 #define ION_BASE_CALLLIST_H_
23 #include "base/macros.h"
61 template <
typename ReturnType,
class... Args>
62 void Add(ReturnType(*func)(Args...), Args&&... args) {
63 calls_.push_back(std::unique_ptr<FunctionCallBase>(
65 func, std::forward<Args>(args)...)));
71 template <
typename Func,
class... Args>
72 void Add(Func&& func, Args&&... args) {
73 calls_.push_back(std::unique_ptr<FunctionCallBase>(
74 new (GetAllocator())
FunctionCall<
typename Func::result_type(Args...)>(
75 std::forward<Func>(func), std::forward<Args>(args)...)));
88 template <
typename Func>
90 return i >= calls_.size()
110 #endif // ION_BASE_CALLLIST_H_
FunctionCall wraps an arbitrary call to a function, including its arguments.
FunctionCall< Func > * GetCall(size_t i)
Returns the ith FunctionCall in this list.
void Add(ReturnType(*func)(Args...), Args &&...args)
Adds a function call to the list of calls to execute, overloaded for non-member (free) functions...
void Add(Func &&func, Args &&...args)
Adds a function call to the list of calls to execute, overloaded for std::functions.
ReferentPtr< CallList >::Type CallListPtr
Thread-safe abstract base class.
CallList contains a list of function calls to execute.
A SharedPtr is a smart shared pointer to an instance of some class that implements reference counting...
This class can be used in place of std::vector to allow an Ion Allocator to be used for memory alloca...