Boost logo

Boost :

From: Alisdair Meredith (alisdair.meredith_at_[hidden])
Date: 2005-06-01 06:49:38


Loïc Joly wrote:

> 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 was also mentioned during the standardisation process.
I am more concerned that

array< std::string, 6 > a1;
array< double, 6 > a2;

a1 inializes all its elements, a2 is not initialized at all.

> 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 hear you loud and clear!
There is certainly a lot of work on the issue of initialization
happening in the Standards committees right now, especially on the
British panel.

My interest in array is largely focussed on std::tr1 specification, and
possibly adopting it in a future standard library. In that context, I
do not want to see any changes until the language sorts out
initialization in general.

>From a Boost perspective: I am happier if array follows the TR1
specification, but should boost libraries be forever frozen once
accepted into a standard TR? I am not sure on the answer to that.

AlisdairM


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