Boost logo

Boost :

From: Andrew Koenig (ark_at_[hidden])
Date: 2002-08-23 13:22:16

Peter> Agreed.

>> The same argument applies to [].

Peter> A weaker version of the argument. Only random access iterators
Peter> have [], so users cannot expect all iterators to supply it.

Right. But they can expect random-access iterators to supply it.

Peter> Theory aside, do users really expect [] from iterators? I have
Peter> never used iterator::[], although I do use iterator::->
Peter> frequently.

I would expect that most users of iterators do not actually require
random-access iterators. There are only three operations that
random-access iterators, and not other iterators, are required to

        iter + integer (and integer + iter)
        iter - iter

Either of the first two operations can substitute for the other,
so the real question is whether the second is much more common than
the first. I suspect it isn't.

Andrew Koenig, ark_at_[hidden],

Boost list run by bdawes at, gregod at, cpdaniel at, john at