Assignment
In the old library it was possible to assign one stream to
another.
This is possible in the iostream library only if
the left hand side is declared to be an assignable class.
A general assignment cannot be allowed because of the interactions
of derived classes.
What, for example, should be the effect of
assigning an
ifstream
to an
istrstream?
Most programs that use this feature can be converted by using a reference
or pointer to a stream.
The old usage:
ostream out ;
out = cout ;
out << x ;
can be replaced by:
ostream* out ;
out = cout ;
out << x ;
or:
ostream_with_assign out ;
out = &cout ;
*out << x ;
Next topic:
char insertion operator
Previous topic:
Interactions with stdio
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005