|
Boost : |
From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2003-05-18 10:02:58
"Alisdair Meredith" <alisdair.meredith_at_[hidden]> wrote in message
news:3EC2012E.2191CF9F_at_uk.renaultf1.com...
> 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?
what about
if( begin( R ) == end( R )
return true;
?
> 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?
is this different than something like
copy( R, back_inserter( my_vector ) );
?
> 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>
I don't understand the "fail" part. Could you be more specific?
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk