Boost logo

Boost :

Subject: Re: [boost] lifetime of ranges vs. iterators
From: David Abrahams (dave_at_[hidden])
Date: 2008-09-03 14:55:35


on Wed Sep 03 2008, Steven Watanabe <watanabesj-AT-gmail.com> wrote:

> AMDG
>
> David Abrahams wrote:
>> on Wed Sep 03 2008, Arno Schödl <aschoedl-AT-think-cell.com> wrote:
>>
>>
>>> As with these end checks, what if dereference would throw exceptions? End
> checks
>>> gone, all the way up the stack...
>>>
>>
>> The problem happens way before dereference: it's the undefined behavior
>> that results from even moving the underlying iterator past the end of
>> the underlying sequence.
>>
>
> Using Arno's suggestion, dereferencing the end iterator
> ought to throw, which happens before we increment
> off the end, right?

The *underlying* iterator? How are you going to get that to throw if
it's a pointer?

> It sounds like he's proposing making iterators work the way they do in
> python.

Sorta, yeah.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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