Nebula
Loading...
Searching...
No Matches
Util::Delegate< T > Class Template Reference

#include <delegate.h>

Detailed Description

template<typename T>
class Util::Delegate< T >

Nebula delegate class, allows to store a function, method or lambda call into a C++ object for later execution.

Note that this does not store any objects or capture, meaning these are extremely vulnerable to dangling pointers. This is by design, since it allows us to have much better performance than for example std::function that does expensive runtime heap allocations for storing objects and lambda capture.

Usage:

// 'Foo' can be a function or static method
Util::Delegate<int(int, float)> funcDelegate = Delegate<int(int, float)>::FromFunction<Foo>();
// Requires an object
Util::Delegate<int()> methodDelegate = Delegate<int()>::FromMethod<MyClass, MyMethod>(MyObject);
// Can not utilize closures!
Util::Delegate<void(int)> lambdaDelegate = [](int a, int b) { return a + b; };
Nebula delegate class, allows to store a function, method or lambda call into a C++ object for later ...
Definition delegate.h:39

See http://www.codeproject.com/KB/cpp/ImpossiblyFastCppDelegate.aspx for implementation details.

See also
Util::Delegate<RETTYPE(ARGTYPES...)>

The documentation for this class was generated from the following file: