I must declare an array of arrays or multidimensional array without know the size. I want to do something similar that I do in this cases with simple arrays:
If you care, you can have a little bit more convenience by have a helper
template
struct C3DArray
{
vector>> m;
C3DArray(int size_x, int size_y, int size_z)
: m(make(T(), size_z, size_y, size_x))
{ }
template static std::vector make(U v, size_t n) {
return { n, std::move(v) };
}
template static auto make(U v, size_t n, Dim... other)
-> std::vector {
return { n, make(v, other...) };
}
};
This uses variadics. Use it like this:
C3DArray arr(3,4,20);