Search This Blog

Friday, November 13, 2009

C++, istream_iterator, ostream_iterator

istream_iterator:
  • overload operator++(): read stream, e.g. >>,
  • then mark if the iterator is the end-of-file iterator e.g. istream_iterator(), i.e., the default constructor acting like an end marker. This is done with overloading operator==()
ostream_iterator:
  • overload operator=(): i.e. if something assgns to ostream_iterator, it will output the value with <<. assuming the value can be used with << to output.

No comments: