Boost logo

Boost Users :

Subject: Re: [Boost-users] iterators must go
From: Scott McMurray ([hidden])
Date: 2009-05-17 21:34:03

2009/5/16 Daniel James <daniel_james_at_[hidden]>:
> Preconditions:
> Either front and back are disjoint, or back is reachable from front
> and front is not reachable from back.
> It's not entirely clear what 'reachable' means - does it just mean
> that the front is at the same position, or does it mean that the
> ranges are identical. If you look at the code for bringToFront it uses
> a method called 'sameHead' (not sameFront for some reason) to detect
> this case, so I think it's referring to that. Here's a test:

My recollection for iterators of "a Reachable from b" means that after
none or more b++, a == b. (Or whatever the equivalent thing with
ranges is.)

> Unsuprisingly, it only gets the first one right. How would the STL
> deal with cases that don't meet the preconditions?
>> It just sounds brittle to me.
> Compared to what?

With iterators, rotate's precondition (m in [b,e]) means that the only
way to fail to meet the criteria is to give an iterator of a different
type or from outside the range. I find that far more obvious than the
two-case range version.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at