This doesn't compile:
vector<int[2]> v;
int p[2] = {1, 2};
v.push_back(p); //< compile error here
What's the alternative? I don't want to use std::array
.
The std::vector
declaration on itself compiles. It's the push_back
that doesn't compile.
You could use a structure containing an array, or a structure containing two integers, if you really don't want to use
std::array
:alternatively, as mentioned, you could use a structure containing an array: