On Sunday, 31 July 2016 20:26:46 UTC+3, Mark wrote:
> Consider:
OK, I will.
>
> # include <iostream>
> # include <cstring >
I trust that you must type here:
# include <cstring>
Otherwise it looks like syntax error.
>
> template < size_t Rows, size_t Cols, typename ElemType = double >
> class TestMatrix
> {
> public :
> ElemType elems[Rows ] [ Cols ];
>
> //ElemType elems[Rows * Cols ];
> };
>
> class Foo
> {
> static const TestMatrix < 2, 2 > test ;
> static const unsigned int val[2][2]; // Specify all dimensions.
> public :
> Foo () ;
> };
>
>
> Foo::Foo()
> {
>
> }
>
> // works C style for multi-dimensional
> const unsigned int Foo::val[][2] = { { 0, 1 } , { 2, 3 } };
>
> const TestMatrix < 2, 2 > Foo::test =
> { { 0.1, 1.1 } , { 2.2, 3.2 } };
I trust that you must type here:
const TestMatrix < 2, 2 > Foo::test =
{ { { 0.1, 1.1 } , { 2.2, 3.2 } } };
Otherwise it looks like syntax error.
>
>
> int main()
> {
>
> }
So?
>
> The compiler I'm using has no C++11 support, that said, how can I
> initialize the static const test member within Foo? Unclear why
> the initialization of test fails when the TestMatrix effectively
> mimics the c-style approach to a multi-dimensional array
>
> Thanks in advance
You did not tell what your problem was besides two obvious syntax
errors. Oh well.