Main Page   Reference Manual   Namespace List   Compound List   Namespace Members   Compound Members   File Members  

Print an object to a debug stream without needing an operator<<. More...

#include <libcwd/cwprint.h>

Detailed Description

Print an object to a debug stream without needing an operator<<.

This utility can be used to print an object to a debug stream without using the normal operator<< of that object (if any exists at all).  The purpose is to allow the printing of objects to debug streams in a different way then when you'd normally print them to say std::cout.

The printable_object (see example below) must have the signature:

class Class {
...
public:
void print_on(std::ostream& os) const;
};
See also
cwprint_using

Example:

Dout( dc::channel, cwprint(printable_object) );
#define Dout(cntrl, data)
Macro for writing debug output.
Definition: debug.h:154
Print an object to a debug stream without needing an operator<<.

this will write printable_object to the debug stream by calling the method print_on.

Copyright © 2001 - 2004 Carlo Wood.  All rights reserved.