The C++03 standard contains a defect regarding the specification of iterators and especially their nested types. Basically, the reference and pointer nested types were underspecified. This was reported as DR445 to the LWG.Under the resolution, an iterator's reference and pointer nested types now have to be the return types of its operator* and operator->, respectively. As part of this change, the specification of istreambuf_iterator has changed to make reference equal to value_type.This resolution was adopted for the committee draft of C++0x in 2008, but can be found in working papers as early as N1804, published 2005-05. Despite this, the resolution still has not been implemented in the Visual Studio 2010 standard library: std::istreambuf_iterator<Ch>::reference is still Ch&.This may seem subtle, but one consequence of this is that it is not possible to instantiate Boost.Spirit's multi_pass iterator adapter with istreambuf_iterator. This is problematic, because using istream_iterator instead involves a performance hit (dereferencing an istream_iterator is far more expensive than an istreambuf_iterator) as well as subtly changed semantics (whitespace skipping leads to bugs that are very hard to track down).
Product Language
Version
Operating System
Operating System Language
Steps to Reproduce
Actual Results
Expected Results
Please wait...