Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members

s11n::object_reference_wrapper< T > Struct Template Reference

object_reference_wrapper is a type for giving access to T objects via their dot operator, regardless of whether they are pointers or not. More...

#include <functor.h>

List of all members.

Public Types

typedef T value_type
typedef T base_value_type

Public Member Functions

 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.


Detailed Description

template<typename T>
struct s11n::object_reference_wrapper< T >

object_reference_wrapper is a type for giving access to T objects via their dot operator, regardless of whether they are pointers or not.

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.


Member Function Documentation

template<typename T>
base_value_type& s11n::object_reference_wrapper< T >::operator()  )  const [inline]
 

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.

Definition at line 109 of file functor.h.


The documentation for this struct was generated from the following file:
Generated on Tue Jul 20 10:46:49 2004 for s11n by doxygen 1.3.7