|
Boost : |
From: Beman Dawes (beman_at_[hidden])
Date: 1999-10-11 09:05:32
Ed Brey wrote:
>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.
Originally, int rather than std::size_t was used as a workaround for
the BOOST_NO_STDC_NAMESPACE problem. Now that we have
BOOST_NO_STDC_NAMESPACE, smart_ptr.hpp has been change to
std::size_t.
Thanks Ed and Valentin.
--Beman
PS: Ed's bio and picture are now up on the web site.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk