vector < vector < vector<int> > > tube;
for(int i=0;i<2;i++)
{
tube.push_back(vector<vector<int> >());
for(int j=0;j<4;j++)
{
tube[i].push_back(vector<int>());
for(int k=0;k<15;k++)
{
tube[i][j].push_back(value);
}
}
}
OR more efficiently:
vector < vector < vector<int> > > tube;
tube.resize(2);
for(int i=0;i<2;i++)
{
tube[i].resize(4);
for(int j=0;j<4;j++)
{
tube[i][j].resize(15, value);
}
}
However if you have to use and resize 3D vectors often then its profitable to write a specialized class for the job but that's a bit more difficult than what we are discussing here.