[Boost-bugs] [Boost C++ Libraries] #3999: multi_pass cannot deal with all input iterators

Subject: [Boost-bugs] [Boost C++ Libraries] #3999: multi_pass cannot deal with all input iterators
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-03-11 15:44:12

#3999: multi_pass cannot deal with all input iterators
 Reporter: cornedbee | Owner: djowel
     Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: spirit
  Version: Boost 1.42.0 | Severity: Problem
 Keywords: |
 multi_pass has trouble with various input iterators.

 First, Microsoft's istreambuf_iterator, because it doesn't implement
 DR445, reports its reference as Char&, but its operator* returns Char.
 This causes compilation errors all over the place.

 Second, a standards-conformant istreambuf_iterator post-DR445 (i.e. C++0x)
 has both operator* return type and reference as Char. This compiles but is
 unsafe because InputPolicy::get_value is specified to return a const
 Value&, and this reference binds to the temporary returned by operator*.
 InputPolicy::get_value should return MultiPass::reference. This would also
 make the Value template parameter to this function superfluous.

 Doing this change allows Spirit to compile with my own istreambuf_iterator
 replacement. I have no idea what to do about Microsoft's
 istreambuf_iterator, though. A workaround for that problem would be nice,
 since using istreambuf_iterator is far preferable over using
 istream_iterator, since the latter is subject to the skipws flag and thus
 easily leads to hard-to-find bugs. (By the way, the documentation should
 prominently mention the danger of skipws.)

Ticket URL: <https://svn.boost.org/trac/boost/ticket/3999>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC