Boost logo

Boost :

From: Ed Brey (brey_at_[hidden])
Date: 1999-10-05 08:57:01


Valentin Bonnard wrote:
>
> Ed Brey wrote:
>
> > I just noticed a minor oddity: for scoped_array and shared_array,
> > operator[] takes an
> > argument of type int. Any reason it isn't type std::ptrdiff_t?
>
> You do mean size_t, don't you ?
> (and yes int is incorrect)

I meant ptrdiff_t, but you are right it should be size_t. I was
thinking ptrdiff_t because that is what's used in section 13.6/13,
where operator[] is defined for built-in types. But I forgot that for
built-ins, the index can be negative, whereas it can't for our smart
arrays.

Indeed, std::vector uses size_type, and so should we. Only for our
case, I don't think it is worth typedefing a size_type within
scoped_array or shared_array, so we should just use std::size_t, as
you indicated.


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