Date
2009-05-29.00:00:00
Message id
3356

Content

[ 2009-05-29 Alisdair adds: ]

I agree with the observation that in principle the type 'pointer' may be a proxy, and the words highlighting this are redundant.

However, in the current draught pointer is required to be exactly 'charT *' by the derivation from std::iterator. At a minimum, the 4th parameter of this base class template should become unspecified. That permits the introduction of a proxy as a nested class in some further undocumented (not even exposition-only) base.

It also permits the istream_iterator approach where the cached value is stored in the iterator itself, and the iterator serves as its own proxy for post-increment operator++ - removing the need for the existing exposition-only nested class proxy.

Note that the current proxy class also has exactly the right properties to serve as the pointer proxy too. This is likely to be a common case where an InputIterator does not hold internal state but delegates to another class.

Proposed Resolution:

In addition to the current proposal:

[istreambuf.iterator]

template<class charT, class traits = char_traits<charT> >
class istreambuf_iterator
  : public iterator<input_iterator_tag, charT,
                    typename traits::off_type, charT* unspecified, charT> {