Boost logo

Boost Users :

Subject: Re: [Boost-users] Overloading boost::for_each()
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2010-08-28 19:47:23


On Sat, 28 Aug 2010, Dave Abrahams wrote:

> On Aug 28, 2010, at 3:58 PM, Jeremiah Willcock <jewillco_at_[hidden]> wrote:
>
>> There are several container types (such as typical deque
>> implementations, if you have access to their internals) that can have
>> for_each() implemented for them in a way that is faster than using
>> iterators and a generic for_each() function. Is there a way to take
>> advantage of that in Boost.Range, such as by overloading
>> boost::for_each()? Is there some kind of Iterable concept that doesn't
>> require actual iterators or allows them to be slow?
>
> I presume you're familiar with http://lafstern.org/matt/segmented.pdf?

I had heard of segmented iterators but hadn't looked at them in detail, so
thanks for the link. I'm not sure I want something that's just two-level
and still based on iterators, though; one case I was thinking of is
compressed data that truly has a linear sequence but it might be faster to
have the decompressor control the program's control flow rather than
having the algorithm do it (of course, that isn't as general as iterators,
but works for some algorithms).

-- Jeremiah Willcock


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net