Boost logo

Boost :

From: Bjorn.Karlsson_at_[hidden]
Date: 2004-02-23 08:12:50


> From: Daniel Frey [mailto:daniel.frey_at_[hidden]]

> Should we propose std::regress (the counter-part for
> std::advance) for
> standardization (via a DR)? The current definition of
> std::advance seems
> to limit the number of elements that can be skipped backwards
> to signed
> types, but the container can be larger (OK, in theory, never tried it
> myself :). This would also nicely solve the implementation
> issue for us.

I don't think it's really a defect; there's a slight inconsistency with
regards to the max/min values on most platforms, but nothing inherently
wrong AFAICS. Note that the reverse_iterator trick can be used by client
code too, so the "signed type limit" is easily defeated.
 
[snip]
> right? Although I wonder what happens if T is already a reverse
> iterator. Is it legal to reverse a reverse_iterator? Or do we need a
> trait and implement both cases separately?

Yes, reversing a reverse_iterator this way is fine (because a
reverse_iterator satisfies the iterator requirements).

Bjorn


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