Re: Dereferencing adaptor?

From: Jonathan Turkanis (technews_at_kangaroologic.com)
Date: 02/07/05


Date: Mon, 7 Feb 2005 15:46:19 -0700

Matthias wrote:

> Now, what if coll is a collection of pointers? The predicate will give
> strange results, because it looks only at addresses.
> So, instead of rewriting the predicate to work with pointers, is there
> some kind of dereferencing adaptor already available, which allows me
> to do this:
>
> partition( coll.begin(), coll.end(), Dereference( Predicate() ) );
>
> or something similar?

Try boost's indirect_iterator:

http://www.boost.org/libs/iterator/doc/indirect_iterator.html

Jonathan



Relevant Pages