istream_iterator and ostream_iterator should use std::addressof
Tim Song

Created on 2016-01-01.00:00:00 last changed 67 months ago


Date: 2016-02-07.20:24:45

Proposed resolution:

This wording is relative to N4567.

  1. Edit [istream.iterator.cons]/3+4 as indicated:

    istream_iterator(istream_type& s);

    -3- Effects: Initializes in_stream with &saddressof(s). value may be initialized during construction or the first time it is referenced.

    -4- Postcondition: in_stream == &saddressof(s).

  2. Edit [istream.iterator.ops]/2 as indicated:

    const T* operator->() const;

    -2- Returns: &addressof(operator*()).

  3. Edit [ostream.iterator.cons.des]/1+2 as indicated:

    ostream_iterator(ostream_type& s);

    -1- Effects: Initializes out_stream with &saddressof(s) and delim with null.

    ostream_iterator(ostream_type& s, const charT* delimiter);

    -2- Effects: Initializes out_stream with &saddressof(s) and delim with delimiter.

Date: 2016-02-07.20:24:45

[ 2016-02, Issues Telecon ]

P0; move to Tentatively Ready.

Date: 2016-01-01.00:00:00

To defend against overloaded unary &. This includes the constructors of both iterators, and istream_iterator::operator->.

Note that {i,o}stream_type are specializations of basic_{i,o}stream, but the constructors might still pick up an overloaded & via the traits template parameter. This change also provides consistency with std::experimental::ostream_joiner (which uses std::addressof).

Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2016-03-07 04:11:48adminsetstatus: ready -> wp
2016-02-07 20:24:45adminsetmessages: + msg7966
2016-02-07 20:24:45adminsetstatus: new -> ready
2016-01-13 19:12:12adminsetmessages: + msg7670
2016-01-01 00:00:00admincreate