-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Similar to the fused operation from #9, there are more optimizations possible for random access and contiguous ranges. It would be neat to have them considered.
For random access ranges, the iterator only needs to store a difference_type together with a virtual function reference at(difference_type n) corresponding to the operator[] overload of the iterator. Any traversal or comparison can then be done by integer operations on the difference type; virtual dispatch is only necessary for operator* and operator==(iterator, sentinel).
For contiguous ranges, the iterator only needs to store a pointer. All operations except operator==(iterator, sentinel) can be done without virtual dispatch. For contiguous common ranges in particular, the any_view::iterator should not have any overhead compared to span::iterator.