What are 'aliased stream buffers`? I encountered the term in a comment on an answer of mine.
I've never heard the term before, but in the thread you cite, the person who used it also gave an example: two streams which use the same streambuf.
Of course, just because two streams don't use the same streambuf, doesn't mean that data written to them doesn't ultimately end up in the same place; that they don't alias the same sink, if that is what is meant. There are filtering streambuf's, which forward the actual sinking and sourcing to another streambuf, and on most systems, it's possible to open a file at the system level, and connect a streambuf (or two) to it.
-- James Kanze
It means an object with different name, for example this:
ostream &lbw = cout;
lbw << "Shahid out" << "Sachin in" << endl; //goes to cout!
What probably was meant in the comment there is this:
ofstream file;
file.rdbuf(cout.rdbuf());
// writes to cout
file << "hello";
So now the check there doesn't work:
if(&file == &cout)
// no, it doesn't
来源:https://stackoverflow.com/questions/5296484/what-are-aliased-stream-buffers