Represents a pointer to a function, method or a function object. This type should be allocated on stack and passed to functions by value or by reference. Never use System::SmartPtr class to manage objects of this type.
More...
Inherits System::Details::DelegateHoldingVariables.
|
| Delegate ()=default |
| Default constructor. Constructs the delegate object that does not point to anything. More...
|
|
| Delegate (const Delegate &)=default |
|
Delegate & | operator= (const Delegate &)=default |
|
| Delegate (Delegate &&o) noexcept |
| Moving copy constructor. Takes the ownership of an entity pointed to by the specified delegate. More...
|
|
Delegate & | operator= (Delegate &&o) noexcept |
| Moving assignment operator. Takes the ownership of an entity pointed to by the specified delegate. More...
|
|
template<class T > |
| Delegate (T function, typename std::enable_if<!std::is_bind_expression< T >::value &&std::is_pointer< T >::value &&std::is_function< typename std::remove_pointer< T >::type >::value >::type *=0) |
| Constructor. Constructs a delegate object from the specified pointer to free function or static method. More...
|
|
template<class T > |
| Delegate (T function, typename std::enable_if< std::is_bind_expression< T >::value >::type *=0) |
| Constructor. Constructs a delegate from the specified pointer to the function object generated by std::bind(). More...
|
|
template<class T > |
| Delegate (int functor_tag, T &functor) |
| Constructor. Constructs a delegate from the specified function object. More...
|
|
template<class T > |
| Delegate (long functor_tag, T &&functor) |
| Moving constructor. Constructs a delegate from the specified function object. More...
|
|
template<class MemberType , class ClassType > |
| Delegate (MemberType ClassType::*member, ClassType *obj) |
| Constructor. Constructs a delegate that points to the specified non-static method of the specified object. More...
|
|
template<class MemberType , class ClassType > |
| Delegate (MemberType ClassType::*member, const SharedPtr< ClassType > &obj) |
| Constructor. Constructs a delegate that points to the specified non-static method of the specified object. More...
|
|
template<class R , class... Args> |
| Delegate (std::function< R(Args...)> f) |
| Constructs a delegate object that points to an std::function function object. More...
|
|
ReturnType | operator() (ArgumentTypes... args) |
| Invokes a function, method or a function object that is pointed to by current delegate object. More...
|
|
bool | operator== (const Delegate &f) const |
| Compares two delegate objects to check if they point to the same entity. More...
|
|
DelegateEquality | CompareDelegateTo (const Delegate &other) const |
| Compares two delegates for equality and alikeness. More...
|
|
bool | Empty () |
| Determines if the current delegate object is empty, e.g. does not point to any entity. More...
|
|
template<class ReturnType, class... ArgumentTypes>
class System::Delegate< ReturnType(ArgumentTypes...)>
Represents a pointer to a function, method or a function object. This type should be allocated on stack and passed to functions by value or by reference. Never use System::SmartPtr class to manage objects of this type.
#include "system/delegate.h"
#include <iostream>
void PrintMessage()
{
std::cout << "Hello, world!" << std::endl;
}
int main()
{
Message mes = Message(&PrintMessage);
mes();
return 0;
}
Definition: delegate.h:18
- Template Parameters
-
ReturnType | The return type of a function, method or a function object pointer to which is represented by the class |
ArgumentTypes | The argument list of a function, method or a function object pointer to which is represented by the class |