Topic: istream_iterator overspecified?


Author: Eric Niebler <eric@boost-consulting.com>
Date: Thu, 12 Jul 2007 21:46:03 CST
Raw View
The class definition for istream_iterator in 24.5.1 shows operator*,
operator->, and operator++ (prefix and postfix) as members. It doesn't
have any // exposition only comment. Is this overspecified? Can they be
implemented as free functions?

According to 17.3.1.2/3 [lib.structure.requirements]:

     Interface convention requirements are stated as generally as
possible. Instead of stating       class X has to define a member function
operator++(),       the interface requires       for any object x of class X,
++x is defined.       That is, whether the operator is a member is unspecified.

So, does this apply to istream_iterator, even when the class definition
shows operator++ to be a member?

Ditto for ostream_iterator, istreambuf_iterator and ostreambuf_iterator.

--
Eric Niebler
Boost Consulting
www.boost-consulting.com

The Astoria Seminar ==> http://www.astoriaseminar.com

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]