Boost logo

Boost :

Subject: Re: [boost] [odeint] Iterator semantics
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-07-30 09:52:42


on Mon Jul 30 2012, Karsten Ahnert <karsten.ahnert-AT-ambrosys.de> wrote:

> On 07/29/2012 04:27 AM, Dave Abrahams wrote:
>>
>> on Wed Jul 11 2012, Karsten Ahnert <karsten.ahnert-AT-ambrosys.de> wrote:
>>
>>> The second semantically problem is that the end iterator in principle
>>> does not need to know the stepper as well as the system (lorenz() in the
>>> above example). But all algorithms from the standard library and
>>> Boost.Range assume that the begin and end iterator are of same type.
>>> Therefore you have to put the stepper and the system into the end
>>> iterator too.
>>>
>>> Any ideas or comments about this?
>>
>> Known issue. I don't know of any truly good answers other than
>> range-based algorithms that don't require the existence of iterators.
>
> Do you mean the algorithms from Boost.Range?

I mean algorithms that strictly use range operations c.f. "Iterators
Must Go" by Alexandrescu (google it).

>> In the meantime, there's Boost.Optional.
>
> I will check Boost.Optional but I fear it is not possible to use, since
> it requires the knowledge of the stepper type in advance.

I don't understand your problem deeply, but you can use type erasure
within an optional if knowing types in advance is an issue.

-- 
Dave Abrahams
BoostPro Computing                  Software Development        Training
http://www.boostpro.com             Clang/LLVM/EDG Compilers  C++  Boost

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk