I want to define multidimensional array with the help of variadic template as vector<vector<....>>
, but stumbled upon impossibility to define type initializer_list<initializer_list<...>>
, which is needed for initializer-list-constructor. This briefly can be demonstrated by the following code
template<class T, size_t dim>
class MyArr : vector < MyArr < T, dim - 1 >>
{
public:
typedef initializer_list<MyArr < T, dim - 1 >::ListType> ListType;
//using ListType = typename initializer_list<MyArr < T, dim - 1 >::ListType>;
};
template<class T>
class MyArr<T, 1> : vector < T>
{
public:
typedef initializer_list<T> ListType;
};
Compiler displays "error C2923: 'std::initializer_list' : 'MyArr::ListType' is not a valid template type argument for parameter '_Elem'".
What is the right way to define ListType
type?
Thanks for answers.