Is there a way to create an ostream instance which basically doesn't do anything ?
For example :
std::ostream dummyStream(...);
dummyStream << "Nothing will be printed";
I could just create an ostringstream, but data will be buffered (and I really don't want to make anything with them, so it adds a useless overhead).
Any idea ?
[edit] Found this related question which suits my needs. However, I think it could be useful to have a answer saying how to create a valid (no badbit) output stream with standard c++.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…