Use of class istreambuf_iterator::proxy
From the C++ Standard:
=======================================
namespace std {
template<class charT, class traits = char_traits<charT> >
class istreambuf_iterator : public iterator<...> {
public:
// ...
class proxy; // exposition only
public:
// ...
istreambuf_iterator(const proxy& p) throw();
// ...
proxy operator++(int); // Returns: proxy(sbuf_->sbumpc(), sbuf_)
// ...
};
template <class charT, class traits = char_traits<charT> >
class istreambuf_iterator<charT, traits>::proxy {
charT keep_;
basic_streambuf<charT, traits>* sbuf_;
proxy(charT c, basic_streambuf<charT, traits>* sbuf) : keep_(c),
sbuf_(sbuf) {}
public:
charT operator*() { return keep_; }
};
}
=======================================
I appreciate that using proxy is permissible (i.e., not mandatory) but just
wanted to confirm the behaviour in case it is used (I also note that neither
the library supplied with Visual Studio, nor STLport apppear to use it).
It appears that when operator ++(int) returns proxy, it cannot be re-applied
(you can only have itr++ but itr++++ will not compile). Is this so?
What was the intention with the iterator's constructor taking 'const proxy&
p'?
Thank you.
Paul