Boost logo

Boost :

Subject: Re: [boost] [Iterator][MultiIndex]iterator-specificpartition_point-relatedfunctions
From: Arno Schödl (aschoedl_at_[hidden])
Date: 2008-12-01 04:19:58

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

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?

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

The reason I used a macro is that CRTP requires that library maintainers are willing to change their code. 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.

Instead, I could derive from the existing classes and implement CRTP on top, but that creates two versions of each iterator, which is IMO unwarranted if the semantics of the two are the same, the only difference being performance.


Dr. Arno Schoedl · aschoedl_at_[hidden] 
Technical Director 
think-cell Software GmbH · Invalidenstr. 34 · 10115 Berlin, Germany · 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, gregod at, cpdaniel at, john at