I need a template that gives a multi-dimensional array based on std::array
.
template <typename T, size_t...>
using MyArray = ? // -> here is something I don't know how to write...
The usage is as follows:
static_assert(std::is_same_v<
MyArray<int, 2>, std::array<int, 2>
>);
static_assert(std::is_same_v<
MyArray<int, 2, 3>, std::array<std::array<int, 3>, 2>
>); // the dimension should be the opposite order
MyArray a; // a stacked 2-D array of size 2x3
a[0][2] = 2; // valid index
Any help will be appreciated!