c++vectorpush-back2d-vector

how to pushback a 2D vector


let's say I have a vector storing vectors of strings. std::vector<std::vector<std::string>> MyVec = { {}, {} }

I want to use anything equivalent to .push_back(X) such that the vector will now look as following: { {X}, {} }.

Does anyone have an idea for a way to solve this?


Solution

  • MyVec[0].push_back(x) by @MikeCAT worked.