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 <algo.hpp>

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_typeoperator() (value_type &t)
 Sets this object's proxy object to t and returns t.
base_value_typeoperator() () 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 189 of file algo.hpp.


Member Typedef Documentation

template<typename T>
typedef T s11n::object_reference_wrapper< T >::value_type

Definition at line 191 of file algo.hpp.

template<typename T>
typedef T s11n::object_reference_wrapper< T >::base_value_type

Definition at line 192 of file algo.hpp.


Constructor & Destructor Documentation

template<typename T>
s11n::object_reference_wrapper< T >::object_reference_wrapper ( value_type obj  )  [inline]

Definition at line 194 of file algo.hpp.


Member Function Documentation

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

Sets this object's proxy object to t and returns t.

Definition at line 198 of file algo.hpp.

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

Returns this object's wrapped object.

Definition at line 206 of file algo.hpp.

template<typename T>
bool s11n::object_reference_wrapper< T >::good (  )  const [inline]

Returns true if this object is wrapping a non-0 object, else false.

Definition at line 212 of file algo.hpp.


The documentation for this struct was generated from the following file:
Generated on Sun Apr 27 13:16:04 2008 for libs11n by  doxygen 1.5.3