Boost logo

Boost :

From: Neal Becker (ndbecker2_at_[hidden])
Date: 2005-06-01 07:33:37


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.
>
> By the way, I also dislike the fact that double d; does not initialize
> d, but at least people know that fundamental type do not behave well
> when initialization is concerned.
>

I strongly disagree. Forcing initialization makes code that is not useful
for high performance numerical processing. When we declare a container of
1000000 elements, we don't want to waste time initializing each, unless we
want to.

This is a serious defect in the current std::complex, IMHO.


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