Boost logo

Boost :

From: nbecker_at_[hidden]
Date: 2002-02-13 11:46:51


>>>>> "Matthias" == Matthias Troyer <troyer_at_[hidden]> writes:

    Matthias> On Wednesday, February 13, 2002, at 01:48 PM, nbecker_at_[hidden] wrote:

>>>>>>> "garcia" == garcia <rgarcia1771> writes:
>>
    garcia> --- In boost_at_y..., nbecker_at_f... wrote:
>>>> Default constructed array is then resized to the correct size.
>>
    garcia> Could you provide a code example that shows where this
>> functionality
    garcia> is needed? It seems dangerous to have the copy semantics
>> of an array
    garcia> depend upon whether or not it was default constructed, not
>> to mention
    garcia> whether it had been copied to already or not.
>>
>> I think it is easy to think of examples where the size is not known at
>> construction time. For example, an array that is a member of a
>> class. Default constructor is used because we don't know the correct
>> size when the class is constructed. Later when a class member
>> function is called, the size is known and the array is resized.
>>
>> I don't know why you say "have the copy semantics of an array depend
>> upon whether or not it was default constructed..." Are you saying
>> that in order to allow resizing that this is a necessary consequence?

    Matthias> If a default-constructed array should be resized, why not just
    Matthias> use operator= and assign an array with the correct dimensions,
    Matthias> once those are known?

I think that would probably be OK. The doc said you can't resize. I
didn't know that you could resize by assignment.


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