Wraps function pointers, member functions and lambdas without ever allocating.
More...
template<typename FuncType>
struct SC::Function< FuncType >
Wraps function pointers, member functions and lambdas without ever allocating.
Example:
struct MyClass
{
float memberValue = 2.0;
int memberFunc(float a) { return static_cast<int>(a + memberValue); }
};
int someFunc(float a) { return static_cast<int>(a * 2); }
struct BigClass
{
};
MyClass myClass;
Function<int(float)> func;
func = &someFunc;
func.bind<MyClass, &MyClass::memberFunc>(myClass);
func = [](float a) -> int { return static_cast<int>(a + 1.5); };
BigClass bigClass;
unsigned long long uint64_t
Platform independent (8) bytes unsigned int.
Definition: PrimitiveTypes.h:42
Size of lambdas or less than LAMBDA_SIZE (currently 2 * sizeof(void*)
).
If lambda is bigger than LAMBDA_SIZE
the constructor will static assert.
- Template Parameters
-
FuncType | Type of function to be wrapped (Lambda, free function or pointer to member function) |