[Gabriel Redner]
Can you point me at a reference (pun not intended) for this requirement? The sites I've looked at don't mention this [1-3]. Is it a requirement for, say, bidirectional iterators too? [1] http://www.cplusplus.com/reference/iterator/RandomAccessIterator/ [2] http://en.cppreference.com/w/cpp/concept/RandomAccessIterator [3] http://www.sgi.com/tech/stl/RandomAccessIterator.html
Only Standards - and Working Papers that will become Standards when they grow up - are authoritative. The latest Working Paper is N3485, http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3485.pdf 24.2.7 [random.access.iterators]/1: "A class or pointer type X satisfies the requirements of a random access iterator if, in addition to satisfying the requirements for bidirectional iterators, [...]" 24.2.6 [bidirectional.iterators]/1: "A class or pointer type X satisfies the requirements of a bidirectional iterator if, in addition to satisfying the requirements for forward iterators, [...]" 24.2.5 [forward.iterators]/1: "A class or pointer type X satisfies the requirements of a forward iterator if [...] - if X is a mutable iterator, reference is a reference to T; if X is a const iterator, reference is a reference to const T, [...]" Stephan T. Lavavej Visual C++ Libraries Developer