This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Error in stl?
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.