Boost logo

Boost :

Subject: Re: [boost] [Iterator][MultiIndex]iterator-specificpartition_point-relatedfunctions
From: Arno Schödl (aschoedl_at_[hidden])
Date: 2008-12-29 03:45:39


> I'm still having trouble
> understanding how you can implement a specialization for
> transform_iterator without knowing more than actually possible about the
> semantics of the transformation function.

Am I missing something?

namespace boost {

template< typename UnaryFunction, typename It, typename UnaryPred >
transform_iterator<UnaryFunction, It>
partition_point(
  transform_iterator<UnaryFunction, It> itBegin,
  transform_iterator<UnaryFunction, It> itEnd,
  UnaryPred pred
) {
  using boost::partition_point;
  return make_transform_iterator(
    partition_point(
      itBegin.base(),
      itEnd.base(),
      bind( pred, boost::bind( itBegin.functor(), _1 ) )
    ),
    itBegin.functor()
  );
}

}; /* namespace */

> > Or only have the default implementation in a separate library and implement the
> > partition_point overloads in Boost.Iterator/Boost.MultiIndexContainer's
> > iterator-specific header files, such as transform_iterator.hpp?

> I'm getting confused, sorry.

You a) either implement all custom partition_points together in a library, or b) only put the infrastructure for such custom partition_points into a library and put the iterator-specific custom partition-points close to the respective iterator implementations.

Arno

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