
30.10.2013 5:38, TONGARI J:
That reminds me CountedRanges from STL: http://www.youtube.com/watch?** v=dUEA8fHx0r0&t=35m14shttp://www.youtube.com/watch?v=dUEA8fHx0r0&t=35m14s Thanks for the link,I'll take a look later.
(note, it is link to exact moment which lasts several minutes, not the whole video)
What type of underlying iterator you plan to use, let say for ForwardIterator? So called 'counted_iterator', same category as the wrapped one. It looks like this type will contain not just iterator, and *efficient* implementation is not clear for me. The states are:
iterator it; std::size_t count;
For comparison, only count is compared; dereference is simply *it; increment both it & count;
1. So, span(first, n) and span(next(first), n) will result in "equal" iterators? 2. As I understand, span(first, n) will produce following "iterators": begin {.it = first, .count = 0} end { .it = ???, .count = n } What is end.it? Especially you mentioned that you plan to preserve same range category as original iterator has - what about BidirectionalIterators? -- Evgeny Panasyuk