In C++/CLI, you can specify the following for multidimensional arrays.
array<int, 2>^ Foo = gcnew array<int, 2>(10);
Foo[0, 0] = 1;
Foo[1, 0] = 2;
// ...
I'm trying to replicate the above in the closest syntax possible in standard C++ (C++11 is allowed) via a templated class called my_array.
e.g.
template <typename T, int rank = 1>
class my_array { };
Is it possible via some comma operator overloading tricks to achieve C++/CLI's syntax under standard C++, along with overriding my_array's subscript operator?
Ideally, I'd like the my_array used this way (equivalent to the above example):
my_array<int, 2> Foo = // ... (ignore this part - already implemented)
Foo[0, 0] = 1;
Foo[1, 0] = 2;
// ...
In case anyone's wondering, I'm creating a C++/CLI equivalent for GCC and currently the framework does not support multidimensional arrays. I'm looking to add that functionality in the closest possible way syntax wise to C++/CLI.