DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
A List Class Library for C++ - List(C++)

Output

There are two operations which permit output to ostreams from List<T>s and List_of_p<T>s.

Not everyone who uses List<T>s will want to use these output operations. In fact, if T::operator<<() is not defined, these operators will not work!

Xout << L sends a copy of List L to ostream Xout and returns Xout. The format is as follows: a left parenthesis is placed on the stream, followed by the space-separated members of the List (which are placed on the stream by T::operator<<()), followed by a right parenthesis.

Xout << Lp sends a copy of List_of_p Lp to ostream Xout and returns Xout. The format is as follows: a left parenthesis is placed on the stream, followed by the space-separated dereferenced members (since the List holds pointers to Ts) of the List (which are placed on the stream by T::operator<<()), followed by a right parenthesis.

These operations are rather simplistic. You can write customized output functions for your own List types using techniques described in the ``Example'' section.


Next topic: List iterators
Previous topic: Replacement

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005