Why isn't this a Contradiction? i.e What did I understand wrong?
The book "Thinking in C++(V2)" gives something like the following example:
Code:
int main()
{
ifstream in("a.cpp");
while(in.get(*cout.rdbuf()))
in.ignore();
return 0;
}
It compiles and works correctly.
But my <streambuf> file says:
Quote:
Originally Posted by streambuf
* -# Stream buffers can impose various constraints on the sequences
* they control. Some constraints are:
* - The controlled input sequence can be not readable.
* - The controlled output sequence can be not writable. <------------- [THIS is the line I'm talking about]
* - The controlled sequences can be associated with the contents of
* other representations for character sequences, such as external
* files.
* - The controlled sequences can support operations @e directly to or
* from associated sequences.
* - The controlled sequences can impose limitations on how the
* program can read characters from a sequence, write characters to
* a sequence, put characters back into an input sequence, or alter
* the stream position.
* .
But the code compiles and runs as expected.
Isn't cout's streambuf being written on in the example ?
Or..more likely...what punchline am I missing ?