how to create a vector of int 2D array in c++
This question already has an answer here:
Native arrays are not copyable, moveable or assignable, so they cannot be stored in a standard container.
However, the wrapper std::array<T,N>
is, so std::vector<std::array<std::array<int, 2>, 2> >
is one way to do what you want.
You can create a 2D vector in this way: std::vector <std::vector <data_type> > vector_name
Note: In C++03, there must be a white space between >
and >
.