On Jul 4, 11:25*am, er <erwann.rog...@gmail.com> wrote:
> Hi All,
>
> I have an array
>
> x00,x01,x02,...,x0K0
> x10,x11,x12,...,x1K1
> .
> .
> .
> xm0,xm1,xm2,...,xmKm
>
> m is *fixed*,
Using a vector for the rows should be fine then (the outer vector
below), because the number of rows never change.
> each of K0, K1,...,Km is occasionally changed i.e. each row is
> "resized" *occasionally*
Using a vector for each row is fine too.
> each row is modified *often* by the transform algorithm
vector for rows is still fine.
> does *std::vector<vector<some type> > seem fine?
Yes.
> or is any reason to
> prefer
> std::vector<std::shared_ptr<vector<some type>> > from an efficiency
> standpoint?
The one with shared_ptr could be unnoticably slower because of the
extra indirection through the shared_ptr. The vector<vector> uses
indirection anyway: sizeof(vector<some_type>) should be constant
regardless of the size of the vector.
If anything, a vector of vector of shared_ptr could make a difference
vector<vector<shared_ptr<some_type> > >
if some_type is very expensive to copy or noncopyable. In that case
you may want to consider boost:

tr_vector as well:
vector<ptr_vector<some_type> >
Ali