I want to have something like this below:
template <class T>
struct Container{
public:
//[] operator
private:
T containment;
};
the containment is supposed to be an array with any selective number of dimensions as below:
Container<int[20][4]> obj;
Container<int[5][2][6]> obj1;
//etc...
And I want to implement the [] operator so that following assignments be possible:
obj[2][3]=6;
obj1[1][1][3]=3;
//etc...
But after a few tries I found myself stuck, how’s that possible?
Who thought reference would come into play here? me!
Thanks to Niki Yoshiuchi, The answer in exact framework that I want is as it follows: