I have a vector of vectors, say
std::vector< std::vector<int> > my2dArray;
Now I would like to have a vector that contains the sizes of the vectors inside my2dArray. Manually this would look something like
std::vector<int> mySizes;
for (int i = 0; i < my2dArray.size(); i++ )
{
mySizes.push_back( my2dArray[i].size() );
}
Is there a more “elegant” way of doing this – without manually writing a loop – by making use of some STL algorithm or the like?
C++03: