Hello,
I would like to use for loop to create vectors in my main vector. I would like the first vector to be of length of 1 another of length of 2 and the 'n' vector of length of n.
MainVec(Length: n = 4)
/\"Small" vectors
|--->(L: 4)
|-->(L: 3)
|->(2)
|>(1)
1 2 3 4 5 6 7
long n;
std:cin << n;
std::vector<long> MainVec (n,0);
for( long y = 0; y < n; y ++ )
{
MainVec[y] = std::vector<long> SmallVec (y+1,0);
}
auto: http://www.stroustrup.com/C++11FAQ.html#auto
In this case, the type is deduced to be std::vector<long> - the type of the values that the outer vector contains.
Ergo, const auto&: reference to const std::vector<long>.