26 #ifndef LIBCWD_CWPRINT_H
27 #define LIBCWD_CWPRINT_H
35 template<
class PRINTABLE_OBJECT>
38 PRINTABLE_OBJECT
const& M_printable_object;
40 cwprint_tct(PRINTABLE_OBJECT
const& printable_object) : M_printable_object(printable_object) { }
45 operator<<(std::ostream& os, cwprint_tct<PRINTABLE_OBJECT>
const& __cwprint)
47 __cwprint.M_printable_object.print_on(os);
88 cwprint(T
const& printable_object)
90 return cwprint_tct<T>(printable_object);
97 template<
class PRINTABLE_OBJECT>
98 class cwprint_using_tct {
99 typedef void (PRINTABLE_OBJECT::* print_on_method_t)(std::ostream&)
const;
101 PRINTABLE_OBJECT
const& M_printable_object;
102 print_on_method_t M_print_on_method;
104 cwprint_using_tct(PRINTABLE_OBJECT
const& printable_object, print_on_method_t print_on_method) :
105 M_printable_object(printable_object), M_print_on_method(print_on_method) { }
110 operator<<(std::ostream& os, cwprint_using_tct<PRINTABLE_OBJECT> __cwprint_using)
112 (__cwprint_using.M_printable_object.*__cwprint_using.M_print_on_method)(os);
155 template<
class T,
class T_OR_BASE_OF_T>
157 cwprint_using_tct<T_OR_BASE_OF_T>
158 cwprint_using(T
const& printable_object,
void (T_OR_BASE_OF_T::*print_on_method)(std::ostream&)
const)
160 T_OR_BASE_OF_T
const& base(printable_object);
161 return cwprint_using_tct<T_OR_BASE_OF_T>(base, print_on_method);
Print an object to an ostream using an arbitrary method of that object.
Print an object to a debug stream without needing an operator<<.
namespace for libcwd.
Definition: debug.cc:87
std::ostream & operator<<(std::ostream &os, memblk_types_nt memblk_type)
Allow writing a memblk_types_nt directly to an ostream.
Definition: debugmalloc.cc:688