williamwong:
Problem now, I like to define ndarray, but how to do it without create classes C3dArray, class C4darray, and repeat all the same methods that are coded in C2dArray?
template <typename T> class CArray { T m_array[]; public: // and methods that deal with 1darray operations }; void OnStart() { CArray<CArray<CArray<int>>> Array; }
fxsaber:
Very ingenious way of using template. Thanks for the tip :-)

How to use class forward declaration?
- 2017.10.12
- www.mql5.com
I am trying to build a 1d array that can take in 2d array as index and return another 2d array with the contend of 1d array: 3 sample files are att...

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I understand that template <typename T> can be used to define a container class of type T at compile time. For example:
template <typename T> class C1dArray { T m_array[]; public: // and methods that deal with 1darray operations };
I can define C1dArray<int> and it will be an array of integers, C1dArray<double> and it will be an array of double.
So I started to define 2d array with the following definition:
Good, now I can use 2darray that contain any type I need.
Problem now, I like to define ndarray, but how to do it without create classes C3dArray, class C4darray, and repeat all the same methods that are coded in C2dArray?