Boost logo

Boost :

From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2002-08-23 13:18:33


"Fernando Cacciola" <fcacciola_at_[hidden]> writes:

| ----- Original Message -----
| From: "Gabriel Dos Reis" <gdr_at_[hidden]>
| To: <boost_at_[hidden]>
| Sent: Friday, August 23, 2002 1:11 PM
| Subject: Re: [boost] iterator::operator[]
|
|
| > "Peter Dimov" <pdimov_at_[hidden]> writes:
| >
| > | > The same argument applies to [].
| > |
| > | A weaker version of the argument. Only random access iterators have [],
| so
| > | users cannot expect all iterators to supply it.
| >
| > The whole story about iterators started with pointers :-) And users
| > do use [] with pointers (which are supposed to provide a canonical
| > example of random access iterator).
| >
| Yes, but users do use [] with pointers because a pointer can be used to
| refer to an array -a container-.

More accurately, a pointer can be used to designate a *sub*-sequence --
a sub-container. That excatly is the situtaion where I found C__
programmers using [] for random access ietartors.

[...]

| IMO, subscripting should have never been part of the iterator semantics.

That is a respectable opinon. Others have differents and practice is
different :-)

-- Gaby


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