
On 10/30/06, Jason Hise <0xchaos@gmail.com> wrote:
Actually, I wonder if it is even valid to say that this container supports random access... although it supports the syntax for it, isn't random access defined as being constant time?
From: Michael Fawcett
I don't think so. I'm pretty sure RandomAccess only means that the iterator supports the required arithmetic syntax, i.e. ++iter, iter++, iter + n, iter += n. I am by no means an iterator guru.
Sorry. Jason is right. Section 24.1 paragraph 8 of the standard: All the categories of iterators require only those functions that are realizable for a given category in constant time (amortized). (If there weren't a constant time requirement, there would be no point in distinguishing bi-directional iterators from random access iterators. bi-directional iterators can always implement += n by repeated increment.) -- Martin Bonner Martin.Bonner@Pitechnology.com Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB24 6WZ, ENGLAND Tel: +44 (0)1223 203894