Boost logo

Boost :

From: Alisdair Meredith (alisdair.meredith_at_[hidden])
Date: 2003-05-14 03:41:18

Larry Evans wrote:

> What about a method indicating an "empty" range with
> complexity O(1) instead of < O(size). This would be
> useful for list containers. I chose "empty" for the
> name because it's used for similar purpose in stack.

How would you guarantee O(1) for ranges bounded by iterators that
evaluate functions?

Is the behaviour of empty() on a istream range intuitive? That it can
be initially empty, but change 'emptiness' by means entirely beyond the
control of their host program?

I agree empty() is as likely as useful for ranges as containers, but I'm
not sure we want to pin down its performance too hard. Otherwise we
will have range-like objects that fail simply because of some extra
requirement on empty(). We already have two
containers-that-are-not-containers, I don't want to go the same way <g>


Boost list run by bdawes at, gregod at, cpdaniel at, john at