Is there a way in C++ to check if an ostream object is cout or a ofstream object?
ostream
cout
ofstream
Something like:
ostream& ou
It's possible by checking the stream's 'identity': if ( &out == &cout ) ....
if ( &out == &cout ) ...
However, I'm in doubt on the usefullness of this test. If your function can handle any output stream, why bother about what stream it is using?