W
Wiseguy
consider the following:
ostream_iterator<int> i(cout,"");
cout << setw(3);
copy(int_list.begin(),int_list.end(),i);
the problem is that the field width restriction is only active for the first
element of int_list. after the first element is copied to cout the stream
setw(3) no longer has any affect.
why? and how to use stream_iterators that don't modify the state of setw()?
ostream iterators are of no use to me unless they can be used to
enforce more complicated text formatting than the
ostream_iterator(ostream&,string) constructor provides for.
ostream_iterator<int> i(cout,"");
cout << setw(3);
copy(int_list.begin(),int_list.end(),i);
the problem is that the field width restriction is only active for the first
element of int_list. after the first element is copied to cout the stream
setw(3) no longer has any affect.
why? and how to use stream_iterators that don't modify the state of setw()?
ostream iterators are of no use to me unless they can be used to
enforce more complicated text formatting than the
ostream_iterator(ostream&,string) constructor provides for.