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
support:

        iter[integer]
        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], http://www.research.att.com/info/ark

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk