Amir Shushtarian: Is there anyway to return array's index by reference in mql5? If not, is there any way to define []= operator to change values of that array inside the class?
Since MTx doesn't have pointers (only handles to classes,) it can't be done directly with POD.
If you have operator[] returning the internal array element, then no.
if you have operator[] return a helper class (containing pointer to the container class and the index) then the helper class can convert the assignment (*helper=value) to container.put(index,value). But then you can't do Print(container[x]) but instead Print(container.get(x))
IMO, it's not worth it. Just define container.put(index,value) and container.get(index) and be done.
Got it,
thanks
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
Hi everyone,
I'm want to define []= operator in a class to change values of an array inside that class.
Is there anyway to return array's index by reference in mql5? If not, is there any way to define []= operator to change values of that array inside the class?