Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-06-03 14:47:26


Neal Becker <ndbecker2_at_[hidden]> writes:

> David Abrahams wrote:
>
>> christopher diggins <cdiggins_at_[hidden]> writes:
>>
>>> ----- Original Message -----
>>> From: "Neal Becker" <ndbecker2_at_[hidden]>
>>>>
>>>> Here's my version:
>>> [snip]
>>>
>>> That code looks great! Any reason it can't go into boost as is? I would
>>> like to see that and a version which takes the step as a template
>>> parameter, to improve efficiency when the step size is known at
>>> compile-time.
>>
>> A. there are no tests
>>
>> B. What about the undefined behavior that results when you stride off
>> the end of a container?
>>
>>
>
> Is there any reasonable way to detect this? If it is feasible without
> significantly increasing cost, I'll add it - but offhand I don't know that
> it is generally feasible.

If it's random access you can store a base iterator and an index.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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