Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий
Особенности языка mql5, тонкости и приёмы работы
fxsaber, 2017.04.27 13:38
template <typename T> class CASTING { public: template <typename T1> static const T Casting( const T1 &Value ) { union CAST { T1 Value1; const T Value2; CAST( const T1 &Value) { this.Value1 = Value; // a custom operator can spoil everything } }; const CAST Union(Value); return(Union.Value2); } }; #define _C(A, B) CASTING<A>::Casting(B) void OnStart() { MqlTick Tick = {0}; Tick = _C(MqlTick, Tick); // Tick = (MqlTick)Tick; }
HarriMQL5: According to https://docs.mql4.com/basis/types/classes union is a reserved word. However, when I try to use it, the compiler doesnt recognise it. I have build 1090.
Your code complies just fine in a script (with/without property strict.)
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
According to https://docs.mql4.com/basis/types/classes union is a reserved word. However, when I try to use it, the compiler doesnt recognise it. I have build 1090.