From: Brey, Edward D (EdwardDBrey_at_[hidden])
Date: 2002-01-08 18:22:39
> There should be an insert interface which inserts in-order.
> There should also be one that inserts "with hint" at the closest
> position to the supplied iterator.
> If I understand you correctly, you're saying that there should be
> validated and non-validated insertion, where the non-validated
> a postcondition of an ordered (and hence acceptable for lookup)
> the position argument be the correct insertion spot in a
Nope, I want to say instead that lookup has a precondition that the
container is sorted. IOW, I want to be able to say:
, make_reverse_iterator(make_counting_iterator(30))); // legal!
x.lower_bound(42); // illegal
x.lower_bound(42); // legal
OK. It sounds like the we are saying the same thing in slightly different
words. I agree that lower_bound needs the precondition that the container
is sorted? So when is the container sorted? When unsafe_insert's
postcondition says that it is sorted. When is that? When unsafe_insert's
position parameter happens to be the right location.
Your example makes the second lookup work by doing a sort. My example makes
it work by inserting into the right location in the first place so that the
container is never unsorted in the first place. Both methods should be
My proposal was the original resolution to
"chickened out" and opted not to invent new functionality at the
My reading of this indicates that the plan is to continue to _not_ give the
programmer control over the insertion location. This is too bad, since that
would comes in handy on occasion. It would be nice if the vector
associative containers provided the programmer control over precise
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk