Ion
|
FunctionCall wraps an arbitrary call to a function, including its arguments. More...
#include "functioncall.h"
FunctionCall wraps an arbitrary call to a function, including its arguments.
The arguments can be queried and modified after the instance is created, making this a very flexible method for storing and calling functions. Note that after creation, the target (function to call) is fixed, even though the arguments can be modified.
Example usage: ///< Free function bool IntFunc(int i) {...}. FunctionCall<bool(int)> int_func(IntFunc, 1); int_func(); ///< Invokes IntFunc(1). int_func.SetArg<0>(10); ///< Changes the value of the 0th argument to 10. int_func(); ///< Invokes IntFunc(10). ///< Member function void ClassType::DoubleFunc(double d) {...}. FunctionCall<void(double)> double_func( std::bind(&ClassType::DoubleFunc, &instance, std::placeholders::_1), double_func();
This declares the template as taking a single argument so that it can be specialized for different function signatures which require multiple template arguments.
Definition at line 59 of file functioncall.h.