Boost logo

Boost :

Subject: Re: [boost] Breaking existing libraries
From: Michael Marcin (mike.marcin_at_[hidden])
Date: 2008-12-03 14:50:17


David Abrahams wrote:
>
> Seems to me, requiring empty() in ranges is sort of equivalent to
> requiring iterators to support distance.
>

Does removing empty from the range concept prevent the empty algorithm
from being specialized for ranges with a more efficient way to determine
calculate empty?

For instance a vector-like range might store a pointer to the first
element and a element count in this case empty is

bool empty() const { return !count; }

where as the default range empty is equivalent to writing empty as

bool empty() const { return p != p+count; }

perhaps there is a range refinement which can support ranges which have
a more efficient empty?

-- 
Michael Marcin

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