Boost logo

Boost :

From: rwgk (rwgk_at_[hidden])
Date: 2002-03-08 15:17:02


--- In boost_at_y..., "Peter Dimov" <pdimov_at_m...> wrote:
> Why would anyone want an uninitialized vector? One legitimate
reason is that
> you have an existing C-style library function 'f' that will
initialize it.

Of course purely for performance reasons.

> I don't see how the iterator interface can be used to achieve the
same
> effect. If the current vector interface is enough, why all this
talk about
> uninitialized values?

Consider

std::vector<double> > vec(10000000);
// here is an algorithm that fills vec with the result of
// some complex algorithm.

Doesn't it seem glaringly stupid that there is no way
of avoiding the initialization?

Ralf


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