#include <functor.h>
Public Types | |
typedef T | value_type |
typedef T | base_value_type |
Public Member Functions | |
object_reference_wrapper () | |
object_reference_wrapper (value_type &obj) | |
base_value_type & | operator() (value_type &t) |
Sets this object's proxy object to t and returns t. | |
base_value_type & | operator() () const |
Returns this object's wrapped object. | |
bool | good () const |
Returns true if this object is wrapping a non-0 object, else false. |
Intended for use with value_types which come from, e.g., std::list, so objects of those types can be called using the same syntax regardless of whether they are pointer types or not.
e.g., assuming MyType might be a pointer or a reference, we can ignore that difference for call-syntax purposes with:
object_reference_wrapper<MyType> wrap; wrap(myobj).memberfunc();
or:
object_reference_wrapper<MyType> wrap(myobj); wrap().memberfunc();
Definition at line 87 of file functor.h.
|
Returns this object's wrapped object. ACHTUNG: this function WILL Cause Grief if it is called on a default-constructed version of this object: you must set this object's wrapped value using the ctor (or via copying) before calling this. |