Article ID: 131312
Article Last Modified on 7/5/2005
template <class T> ostream& operator<<( ostream&, T& ); //or
template <class T> istream& operator>>( istream&, T& );
iostream_specifier insertion/extraction_operator manipulator
For example:
cout << endl; // fails if template operator << was defined
cout << flush; // fails if template operator << was defined
cin >> ws; // fails if template operator >> was defined
cout << a << endl; // does not fail cout << '\n' << flush; // does not fail cin >> a >> ws; // does not fail
/* Compile options needed: none
*/
#include <iostream.h>
#include <strstrea.h>
template <class T> ostream& operator<< ( ostream&, T& );
template <class T> istream& operator>> ( istream&, T& );
void x(ostrstream &ot)
{
int a;
cout << endl; // internal compiler error
ot << flush; // internal compiler error
cin >> ws; // internal compiler error
cout << "test" << endl; // no error
ot << '\n' << flush; // no error
cin >> a >> ws; // no error
}
Additional query words: 9.00 9.0 2.00 2.10 9.10 9.1
Keywords: kbbug kbfix KB131312