Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2004-01-21 15:03:23


At 10:41 AM 1/21/2004, Peter Dimov wrote:

>Yes, shared_array can be extended that way. But my point was much
simpler:
>you can assert(i >= 0) in operator[](ptrdiff_t i) to catch s[-1], but you
>can't if i is size_t, and s[-1] still works. :-)

IIRC, that was the rationale given by Bjarne and others for the desire to
use of a signed type in similar cases. He was complaining about some
library code that used size_t as an array index, precluding a simple
assert(i >= 0).

--Beman


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