Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-03-08 15:43:24


From: "rwgk" <rwgk_at_[hidden]>
> vector<double> vec(100000, uninitialized_flag());
>
> means these things:
>
> 1. I do not want to waste time for something that I am
> absolutely sure I do not need (the default construction)
> because
>
> 2. I am about to fill the memory with the given number
> of elements by some other facility, and

Exactly, and that is the problem I was trying to address. Simply pass that
"other facility" to the vector constructor. You never need uninitialized
memory.

> Being safe by default is great, but IMO forcing everyone to
> waste time only to be safe under any conceivable eventuality
> is misguided and may be one of the reasons why C++ still has
> a bad reputation among many (non-computer) scientists.

"C++" and "safe by default" in the same sentence? :-)


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