|
Boost : |
Subject: Re: [boost] [Iterator][MultiIndex]iterator-specificpartition_point-relatedfunctions
From: Arno Schödl (aschoedl_at_[hidden])
Date: 2008-12-01 13:03:09
>> Specifically for my application, you (as maintainer of
>> boost.Iterator?) would have to change
>> boost::transform_iterator/filter_iterator and Joaquin
>> multi_index_container. If we can agree on that, I will change the code
>> to CRTP.
> I am willing to consider such changes.
CRTP it is.
>> How is that clever? It follows the same pattern as the one for a custom swap:
>>
>> using std::swap;
>> CustomType tA, tB;
>> swap( tA, tB );
>>
>> What do you propose instead?
> I think if you want to call lower_bound in the most efficient way, it
> should be possible to do so with qualification. If the algorithm in
> std:: isn't sufficiently "hookable," one should create a different one
> that is. The universe of names to be found by ADL should be limited to
> fundamental operations like swap, since ADL reserves names "globally."
Hmmm. I see it this way: std::lower_bound has well-defined semantics, and we don't change them. We merely provide an implementation for a particular iterator. If that would be the end of the story, you would probably agree that ADL is the way to go and
using std::lower_bound;
lowerbound(customIt, customIt, ...); // unqualified
is the right way to call the custom lower_bound.
Now it happens that for some class of iterators, lower_bound/... can be implemented on top of partition_point. I consider this an implementation detail, which you specify by deriving this iterator from a particular base class. I think the situation is really the same as in Boost.Operators that implements operator+ via operator+=.
-- Dr. Arno Schoedl · aschoedl_at_[hidden] Technical Director think-cell Software GmbH · Invalidenstr. 34 · 10115 Berlin, Germany http://www.think-cell.com · phone +49-30-666473-10 · toll-free (US) +1-800-891-8091 Directors: Dr. Markus Hannebauer, Dr. Arno Schoedl · Amtsgericht Charlottenburg, HRB 85229
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk