Boost logo

Boost :

Subject: Re: [boost] [iterators] Proof-of-concept for a sentinel iterator adapter
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-05-13 18:01:41

Beman Dawes wrote:

> Yes, that's one of the approaches I considered.
> One issue with that approach is that optimizers can't always see into
> function objects. Although C++0x Lambda will fix that, at least for
> some compilers, the predicate adds a bit of complexity to an otherwise
> very simple specification.

That's how filter_iterator and transform_iterator, the adapters of
Boost.Iterator, work. (as well as the derived Boost.RangeEx adapters
that were accepted recently)
I suppose it would be best to keep that design.

I fail to see your point about function objects though.
Maybe you're actually thinking of using type erasure? That would be
quite a bad idea. The adapter should be templated on both the iterator
type and the function object type.

This has generated code without overhead for years on all decent
compilers I'm aware of. Compilers have no problem inlining a call to a
function object.
Thankfully, since the whole algorithms part of the standard library
depends on that...

Boost list run by bdawes at, gregod at, cpdaniel at, john at