Boost logo

Boost :

Subject: Re: [boost] [Iterator][MultiIndex]iterator-specificpartition_point-relatedfunctions
From: David Abrahams (dave_at_[hidden])
Date: 2008-11-30 14:54:33


on Sun Nov 30 2008, Arno Schödl <aschoedl-AT-think-cell.com> wrote:

>>> This would require the user to specify "using boost::lower_bound" if he wants to
>>> implement a custom_partition for one of his own iterators outside namespace boost,
>>> right?
>>
>>Why do you say that a using declaration is needed? What's wrong with
>>calling lower_bound with qualification?
>
> Arguably, to be compatible with code that does not know anything about boost, in the
> spirit of ADL, the following lower_bound should redirect to partition_point( CustomIt,
> CustomIt, pred):
>
> using std::lower_bound;
> CustomIt itA, itB;
> lower_bound( itA, itB );
>
> Do we agree that this is how the client side should work?

No, I don't think so. I'm not sure exactly the implications but at
first glance it looks too clever by half.

> The only way to achieve that, as far as I can see, is to implement a lower_bound for
> each and every iterator that defines its own partition_point. Or do you have an idea?

You can always provide a CRTP base class template people can use, and
implement lower_bound for that.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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