Title
istreambuf_iterator::proxy::operator* should be const
Status
new
Section
[istreambuf.iterator.proxy]
Submitter
Billy O'Neal III

Created on 2018-04-26.00:00:00 last changed 79 months ago

Messages

Date: 2018-06-19.05:49:11

Proposed resolution:

This wording is relative to N4741.

  1. Edit [istreambuf.iterator.proxy] as indicated:

    namespace std {
      template<class charT, class traits = char_traits<charT>>
      class istreambuf_iterator<charT, traits>::proxy { // exposition only
        charT keep_;
        basic_streambuf<charT,traits>* sbuf_;
        proxy(charT c, basic_streambuf<charT,traits>* sbuf)
          : keep_(c), sbuf_(sbuf) { }
        public:
          charT operator*() const { return keep_; }
      };
    }
    
Date: 2018-06-18.00:00:00

[ 2018-06-18 after reflector discussion ]

Priority set to 3

Date: 2018-04-26.00:00:00

operator* on iterators is usually intended to be const; see [input.iterators] Table 87, *a, where a is of type X or const X. (Technically, proxy is implementing the *r++ requirement in this table, and r doesn't imply a const iterator, but there's no reason for the iterator's operator* to differ from the proxy)

History
Date User Action Args
2018-06-19 05:49:11adminsetmessages: + msg9946
2018-05-05 13:25:15adminsetmessages: + msg9842
2018-04-26 00:00:00admincreate