This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] istream_iterator: unexpected read in ctor


Summary:

  Standard say (with a bit misoriented words):

     27.6.1  Class template istream_iterator [istream.iterator]
     1 The class template istream_iterator is an input iterator (27.2.3)
       that reads (using operator>>) successive elements from the input
       stream for which it was constructed.
    ->    After it is constructed, and every time ++ is used, the iterator
    ->    reads and stores a value of T.
     ...

     27.6.1.1 istream_iterator constructors and destructor [istream.iterator.cons]
     ...
     istream_iterator(istream_type& s);
    ->  3 Effects: Initializes in_stream with addressof(s). value may be initialized
    ->    during construction or the first time it is referenced.
     4 Postconditions: in_stream == addressof(s).

  Current position is "After it is constructed ... the iterator reads and stores
  a value of T.": http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0738r0.html

IMO the test (modified according words above) is still useful, I will re-submit it ASAP.

--

   - ptr


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]