Subject: Re: [boost] [range] RFC: span(iterator, size)
From: Evgeny Panasyuk (evgeny.panasyuk_at_[hidden])
Date: 2013-10-29 13:45:04
29.10.2013 19:54, TONGARI J:
> I want to query if there's any interest in such a utility:
> span(iterator, size) : iterator_range
That reminds me CountedRanges from STL:
> which simply returns iterator_range(it, it + size) for RandomAccessIterator;
> for others modeling ForwardIterator, a special iterator adaptor, say,
> counted_iterator is used, so we don't have to advance it just for getting
> the end iterator.
What type of underlying iterator you plan to use, let say for
It looks like this type will contain not just iterator, and *efficient*
implementation is not clear for me.
Just imagine case where next(end(span(first, n))) is legal, like when
original range has more than n elements. What end(span(first, n)) would
have internally, which state? How it can reach end(span(first, n+n))?
Perhaps we need whole new range category in order to make it efficient?
Or maybe just implement algorithms for counted ranges, which can take
advantage of counted range, like Stepanov shows above?
-- Evgeny Panasyuk
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk