A feature I'd like to have is auto-ignoring already printed values. Leaving aside the discussion on whether this is a good idea or not, and about thread safety, here is how I'd like to use my custom stream:
myns::dout << "Hello world!" << myns::endl;
myns::dout << mynd::UNIQMSG_BEGIN << "Hello world!" << myns::endl;
myns::dout << mynd::UNIQMSG_BEGIN << "Hello world!" << myns::endl;
I expect the code above to print Hello world twice. I've been looking into iostream architecture for a while now, but I really can't figure out how to do this exactly. Most resources explain how to write a custom buffer, but to my understanding, that's not what I need. In fact, I'd like to block a given message before it reaches the underlying buffer. This means that my stream will need a second buffer in which it will store the string until a myns::UNIQMSG_END is sent in (hence the custom endl), then finally check if it has ever been encountered, and if not send it to the buffer. Is this the right approach? Any help is appreciated.
Just for reference, here are the links I've been looking at:
http://spec.winprog.org/streams/
http://www.horstmann.../iostreams.html (kind of outdated in my opinion)
http://www.atnf.csiro.au/computing/software/sol2docs/manuals/stdlib/user_guide/loc_io/index.htm
http://www.cplusplus.com/
Thanks in advance!