Boost logo

Boost :

Subject: Re: [boost] [range] RFC: span(iterator, size)
From: TONGARI J (tongari95_at_[hidden])
Date: 2013-10-30 04:18:00


2013/10/30 Evgeny Panasyuk <evgeny.panasyuk_at_[hidden]>

> 30.10.2013 11:29, TONGARI J:
>
>> 1. So, span(first, n) and span(next(first), n) will result in "equal"
>>> iterators?
>>>
>> if you mean begin-or-end(span(first, n)) == begin-or-end(span(next(first),
>>
>> n)), then yes, but it's pathic.
>>
>
> Yes, that what I mean. This limitation should be placed as warning.
>
>
> Especially you mentioned that you plan to preserve same range category as
>>>> original iterator has - what about BidirectionalIterators?
>>>>
>>> That's my mistake, they should be ForwardIterators.
>>>
>>
> 1. What about RandomAccessIterators?
>

For RandomAccessIterators, 'span' will return the iterator as is, no
wrapping.

> 2. Imagine if we have std::list x with 10 elements. Will dereference of
> end(span(begin(x), 5)) be undefined?

It's defined to be non-dereferenceable.


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