Error in stl?

Joe Buck Joe.Buck@synopsys.COM
Thu Aug 19 17:55:00 GMT 2004


On Thu, Aug 19, 2004 at 02:50:46PM +0000, Anders Fugmann wrote:
> Paolo Carlini wrote:
> > Rest assured that our implementation is currently correct, since the 
> > corresponding DR 280
> > 
> >    http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#280
> > 
> > is still *Open*: adding new overloads now would be wrong.
> 
> Thanks for the clarification.

I have worked around similar issues in the past by doing something like

    const std::vector<int>& cv(v);
    for (std::vector<int>::const_reverse_iterator i = cv.rbegin();
        i != cv.rend(); ++i) {
	...
    }

I have also used this technique when iterating over std::string, as there
is a performance cost to creating a non-const iterator to an std::string
that it pays to avoid if only const access is needed.




More information about the Gcc mailing list