The following struct
template<typename T, int rows, int cols>
struct ScalarCustomType
{
T data[rows][cols];
}
works fine in combination with brace initialization, e.g.,
ScalarCustomType<int,3,3> B{{{1,2,3},{4,5,6},{7,8,9}}};
as well as
ScalarCustomType<int,3,3> B{1,2,3,4,5,6,7,8,9};
when compiled with c++11/14 support in g++ and clang++. The latter, however, warns about missing braces in the second case.
The library where this struct will be used requires the presence of the custom constructor
ScalarCustomType(const T& x) : { ... }
which is called in the following manner
ScalarCustmType<double,3,3> A(0) // not A{0} !!!
How can I reimplement the default brace initializer which gets deleted by the custom constructor?
Thanking you in advance and best wishes, Matthias