How to process a few << << << operators as one ?

How can I do that ?
I want to do for my function the same as

cout <<"hello" << a_string << "how are you";

But every << are processed individually.

The mission of my class is a debug function to send messages to the console o
to a listview or to a log file (depends). So I want that :

MYCLASS <<"hello" << a_string << "how are you";
sends "hello peter how are you" to the console or listview or log.

Any help ? Thanks
Try:
cout << "hello" + a_string + " how are you?";
If you want to have all the data delivered at the same time, you can use a buffer:
A call of operator<< would send the characters to that buffer,
When the buffer is full or you flush it you can send all the data at once.
You'll have to add some sort of manipulator to your class so that you can use this:
MYCLASS <<"hello" << a_string << "how are you" << flush;

This will simulate buffered streams
Topic archived. No new replies allowed.