#include <FXGenericTools.h>
Functors are a compile-time abstraction of some callable entity ie; basically an enhanced function or member function pointer. Their real usefulness comes in with binding whereby a functor can be bound with a set of arguments to form an arbitrary call to some API. This facility is used throughout TnFOX as a much improved form of callback plus within the dynamic linkage facilities. Up to four arbitrary parameters are currently supported (this is easily extended, just ask).
With any decent optimising compiler, the considerable complexity of the functor implementation boils down to two virtual method calls. Functor itself only occupies 4 + 8 bytes.
This functor operates with move semantics - a copy means destruction of the original. If you want a real copy, call copy(). You may find the helper function FX::Generic::BindFunctor of use when binding a functor's arguments.
Definition at line 1605 of file FXGenericTools.h.
Public Types | |
typedef FunctorHelper::ImplBaseOp< parslist, TL::length< parslist >::value-1 > | ImplBase |
typedef parslist | ParsList |
typedef ImplBase::R | R |
typedef ImplBase::P1 | P1 |
typedef ImplBase::P2 | P2 |
typedef ImplBase::P3 | P3 |
typedef ImplBase::P4 | P4 |
Public Member Functions | |
Functor () | |
template<typename fn> | |
Functor (fn fnptr) | |
template<typename obj, typename fn> | |
Functor (obj &objinst, fn fnptr) | |
template<typename obj, typename fn> | |
Functor (obj *objinst, fn fnptr) | |
Functor (void_ *fnptr) | |
Functor (ImplBase *_fnimpl) | |
Functor (Functor &o) | |
Functor & | operator= (Functor &o) |
~Functor () | |
Functor | copy () const |
bool | operator== (const Functor &o) const |
bool | operator!= (const Functor &o) const |
operator Tester * () const | |
bool | operator! () const |
R | operator() () |
R | operator() (P1 p1) |
R | operator() (P1 p1, P2 p2) |
R | operator() (P1 p1, P2 p2, P3 p3) |
R | operator() (P1 p1, P2 p2, P3 p3, P4 p4) |
Classes | |
struct | void_ |