Boost logo

Boost :

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


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

> 1. So, span(first, n) and span(next(first), n) will result in "equal"
> iterators?
>

No.

Suppose we have a sequence S = {1, 2, 3, 4, 5}, &i is the iterator to i.
Given first = &1, n = 4,
span(first, n)->[begin {.it = &1, .count = 0}, end { .it = &1, .count = 4
}], which results in {1, 2, 3, 4}
span(next(first), n)->[begin {.it = &2, .count = 0}, end { .it = &2, .count
= 4 }], which results in {2, 3, 4, 5}

> 2. As I understand, span(first, n) will produce following "iterators":
> begin {.it = first, .count = 0}
> end { .it = ???, .count = n }

What is end.it?

end { .it = first, .count = n }

> 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.


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