Boost logo

Boost :

From: Dave Gomboc (dave_at_[hidden])
Date: 2003-06-24 19:26:28


The file "boost/regex/v4/perl_matcher_non_recursive.hpp" includes
statements such as

    end += std::min((unsigned)re_detail::distance(position, last),
desired);

operator+= is appropriate for random-access iterators, but not for
merely bidirectional iterators such as std::list<char>::iterator, which
is what I was using when I came across the problem. [I don't have a
copy of the C++ standard, but I did check sections 2.3.4, 2.3.5, and
3.1.4 (which is of especial relevance) of Generic Programming and the
STL by Matt Austern.]

I received compilation errors using both g++ 3.3 and intel c++ for linux
7.1, but oddly enough, MSVC 7.1 compiles the code without complaint.
(Non-compliance issue, or superior QoI?)

I believe that consistent use of std::advance would solve the problem.
Or would this change be so costly that I ought to use vector or deque?
Unfortunately, doing so would cause me other problems such as iterator
invalidation. :-/

Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk