Q:

C++ - A 3-d data structure - should I use vector of pointers or vector of vectors? 

I have to maintain a data structure which is 3 dimensional.  So let us say it's dimensions are :- l x m x n. In the program that I wish to write l and  m will be known since the time the data structure is being constructed .  But n has to be dynamic throughout runtime.  And n may be different for the different vectors in the grid lxm. ( Once this structure is created I never intend to destruct it as I will be needing it throughout). 
For the moment let us assume it's a 2-dimensional data structure that I wish to make, should I make a vector<vector<int>> or a vector<vector<int>*> ?  Also I know how I might initialise the vector to the required size in the first case, i.e I might do something like :- 
vector<vector<int> > A(m)

to initialise the size of the outer dimension to m. But in the second case, once I have created a vector of pointers to vectors, how do I create the vectors to which the pointers point. 
Carrying this to the 3-d case, should I use , 
a vector<vector<vector>> or a vector<vector<vector*>> or some other combination ?  
Please, suggest any changes so that I may reframe the question if it's not framed properly. 

A:

You're better using a single vector (and not nested ones), since the memory is guaranteed to be contiguous in this case and your code will be way faster due to no cache misses.  In this case, you need to map from 3D (2D) to 1D and vice-versa, but this is pretty straightforward
for 2D:
(x,y) <-> y*DIM_X + x;

for 3D:
(x,y,z) <-> z*(DIM_Y*DIM_X) + y*DIM_X + x;

If you really insist to use nested vectors, you can do something like:
#include <vector>

template<typename T>
using vec = std::vector<T>; // to save some typing

int main()
{
    // creates a 5 x 4 x 3 vector of vector of vector
    vec<vec<vec<double>>> v{5, vec<vec<double>>{4, vec<double>{3}}};
}

EDIT
Responding to your latest edit: use 
std::vector<std::vector<double>> v{DIM_X*DIM_Y, std::vector<double>};
// address (x,y,z)
v[y*DIM_X+x, z] = val_x_y_z;

If you further happen to know the dimensions of the inner vectors, you can preallocate memory for them using std::vector::reserve.  This will speed things up since there won't be any (slow) re-allocations.