Dv::iomanip_m< T > Struct Template Reference

Convert typical member functions to iomanip objects that can be put on a stream using the conventional operator<<. More...

#include <iomanip.h>

List of all members.

Public Types

typedef basetype< T >::base BT
typedef std::ostream &(T::* Print )(std::ostream &) const

Public Member Functions

 iomanip_m (Print f, const BT &t)

Public Attributes

Print print_
const BTt_

Detailed Description

template<typename T>
struct Dv::iomanip_m< T >

Convert typical member functions to iomanip objects that can be put on a stream using the conventional operator<<.

This is version uses the member function directly. However, contrary to Dv::iomanip, it does not directly support virtual member functions. Typical usage example:

 struct C {
   virtual std::ostream print_summary(std::ostream& os) const {
     ..
   }

   Dv::iomanip_m<C> summary() const { 
     return Dv::iomanip<C>(&C::*print_summary, *this);
   }
 };
 
 C c;
 std::cout << "foobar: " << c.summary() << std::endl;

The above does not easily works when subclassing, unlike the approach that uses a static intermediate function.

See also:
Dv::iomanip

Definition at line 105 of file iomanip.h.


Member Typedef Documentation

template<typename T >
typedef basetype<T>::base Dv::iomanip_m< T >::BT

Definition at line 106 of file iomanip.h.

template<typename T >
typedef std::ostream&(T::* Dv::iomanip_m< T >::Print)(std::ostream &) const

Definition at line 107 of file iomanip.h.


Constructor & Destructor Documentation

template<typename T >
Dv::iomanip_m< T >::iomanip_m ( Print  f,
const BT t 
) [inline]

Definition at line 108 of file iomanip.h.


Member Data Documentation

template<typename T >
Print Dv::iomanip_m< T >::print_

Definition at line 109 of file iomanip.h.

template<typename T >
const BT& Dv::iomanip_m< T >::t_

Definition at line 110 of file iomanip.h.


The documentation for this struct was generated from the following file:

dvutil-1.0.10 [ 5 December, 2009]