Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2002-08-23 14:55:38


On 23 Aug 2002, Gabriel Dos Reis wrote:
gdr> Andrew Koenig <ark_at_[hidden]> writes:
gdr>
gdr> | iter[integer]
gdr> | iter + integer (and integer + iter)
gdr> | iter - iter
gdr> |
gdr> | Either of the first two operations can substitute for the other,
gdr> | so the real question is whether the second is much more common than
gdr> | the first. I suspect it isn't.
gdr>
gdr> I just had a glance at the sorting algorithm implemented in SGI STL
gdr> (and now GCC STL) and found that the second operation is more used
gdr> that the first. I, however, agree that std::sort() isn't necessarily
gdr> representative of typical uses.

I'm pretty sure that Matt Austern knew that

iter[i] = x

was not supported by the random access iterator requirements, and instead
carefully made sure that the std::sort() of SGI STL used

*(iter + i) = x

Regards,
Jeremy

----------------------------------------------------------------------
 Jeremy Siek http://php.indiana.edu/~jsiek/
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------


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