Boost logo

Boost :

From: Jonathan Wakely (cow_at_[hidden])
Date: 2005-06-01 05:48:21


On Wed, Jun 01, 2005 at 09:32:24AM +0200, Lo?c Joly wrote:

> AlisdairM a ?crit :
>
> >Aggregate initialization is an important part of the array concept,
> >allowing it to act largely as a plug-in replacement for language
> >arrays, with the bonus it can be passed by value as well as by
> >reference. The main drawback here is that we cannot deduce the size of
> >a boost::array, as you can with a language array.
>
> From my point of view, the main drawback is that in the following code:
>
> vector<double> v1(6);
> array<double, 6> v2;
>
> v1's content is initialized, v2's content is not. In fact, array is
> about the only class I know of that as a default constructor that does
> not initialize member data to a legal and documented value. This I
> strongly dislike.

This is true for any aggregate of builtins:

    struct S { char c; };
    int i[5];

array is supposed to behave like an array.

jon

-- 
"Whenever you find that you are on the side of the majority,
 it is time to reform."
	- Mark Twain

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