
2013/10/30 TONGARI J
2013/10/30 Akira Takahashi
... What do you think about out of range check?
I'd say, it's the user's duty to ensure it won't go over the end.
What situation is it useful?
When you want to ignore the difference between RandomAccessIterator & ForwardIterator while keeping the efficiency of RandomAccessIterator.
Some API may look like this: function(iterator, n, ...) that only require iterator to be ForwardIterator, but the implementation may sacrifice the efficiency of RandomAccessIterator, just because the implementor doesn't want to bother tag-dispatching for such optimization... (OK, I'm the one)
Thank you. I understood your motivation. My opinion is here: First, I wouldn't like to provide iterator interface in Boost.Range functions (expect begin/end). In my opinion, iterator is low layer interface. It is not Boost.Range layer. Second, I rethink interface by first reason: r | random_access_taken(n); or r | random_access_span(n); I don't think useful the function (explicit efficient phrase). At least, we need better name for random access. However, my `taken` implementation hasn't optimization for random access iterator. I'll add optimization to `taken` implementation. Thanks, Akira