I use functions like
void doStuff(type thing, bool print = false, std::ostream& S = std::cout)
{
thing++;
if(print)
S << "new thing: " << thing << '\n';
}
so that I can use the same function and decide on call if I want it to print documentation of what is happening and if I wish I can print that on seperate streams -I don't know if I can even do that with std::ostream-
I now believe that it will be better to do
void doStuff(type thing, std::ostream& S = NULL)
{
thing++;
if(S)
S << "new thing: " << thing << '\n';
}
but that doesn't work as std::ostream doesn't accept NULL
questions:
-is there some kind of constant of the stream type that stops the if condition?
-can I use a different type of stream that is more flexible to accept streams like string streams and file streams?
-is there a better way to handle flexible documentation?