Boost logo

Ublas :

From: Sourabh (sourabh_at_[hidden])
Date: 2007-03-08 21:28:31

I have a std::vector <vector<double> >. I know that the std::vector will
be of size n, so I resize that vector to n. Now this will involve creation
of n vector<double> each of size 0. Later I come to know that each of
these (n vector<double>s) is of size m. So I loop over std::vector and
resize each vector<double> to m.

Is it inefficient way ?

What is the difference in terms of efficiency between the following two
sets of statements ?
1. vector<double> vec (100);

2. vector<double> vec;
   vec.resize (100);

-- Sourabh