7 May
2013
7 May
'13
3:12 a.m.
And in any case, isn't this a flaw? my_iterator can be advanced etc. in constant time - why should the STL be forced to use a possibly-suboptimal overload of some algorithm on account of the reference type?
This exactly the problem that Boost.Iterator is trying to address. It separates access and traversal. So, whereas the random access iterator category requires an lvalue access with random access traversal, in Boost.Iterator you can specify them separately. Unfortunately, the proposal to accept this into C++ was never accepted. There was talk of relaxing the requirements for C++11, but that never happened. And I dont think theres any talk of it for C++14 that I know of. Thanks, Paul