Boost logo

Boost :

Subject: Re: [boost] Breaking existing libraries
From: Neil Groves (neil_at_[hidden])
Date: 2008-12-03 15:13:51


Neil Groves wrote:

I think that empty() is not beneficial as part of the Range concept. It adds
nothing in features or performance.

On Wed, Dec 3, 2008 at 7:50 PM, Michael Marcin <mike.marcin_at_[hidden]>wrote:

> 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?
>

We could use adl to find a boost_range_empty() function from boost::empty().
This could be implemented by comparing iterators by default, and specialised
as desired for optimisation purposes.

>
> --
> Michael Marcin
>

Neil Groves

>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


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