Dv::iomanip< 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.
Detailed Description
template<typename T>
struct Dv::iomanip< T >
Convert typical member functions to iomanip objects that can be put on a stream using the conventional operator<<.
This is the version that uses a static intermediate function. Typical usage example:
struct C {
virtual std::ostream print_summary(std::ostream& os) const {
..
}
static std::ostream print_summary(std::ostream& os, const C& c) {
return c.print_summary(os);
}
Dv::iomanip<C> summary() const {
return Dv::iomanip<C>(print_summary, *this);
}
};
C c;
std::cout << "foobar: " << c.summary() << std::endl;
The above also works when subclassing, unlike the approach that directly uses a member function.
struct D: public C {
virtual std::ostream print_summary(std::ostream& os) const {
..
}
};
D d;
std::cout << "foobar: " << d.summary() << std::endl;
- See also:
- Dv::iomanip_m
Definition at line 50 of file iomanip.h.
Member Typedef Documentation
Constructor & Destructor Documentation
Member Data Documentation
The documentation for this struct was generated from the following file: