Is there a way to create an ostream instance which basically doesn\'t do anything ?
For example :
std::ostream dummyStream(...);
dummyStream <<
If this is to disable logging output, your dummyStream would still cause arguments to be evaluated. If you want to minimize impact when logging is disabled, you can rely on a conditional, such as:
#define debugStream \
if (debug_disabled) {} \
else std::cerr
So if you have code like:
debugStream << "debugging output: " << foo() << std::endl;
No arguments will be evaluated if debug_disabled is true.