using c++17 in mql5

using c++17 in mql5

Manage alerts

Loading saved threads...

H.M · External communityPost link
External question — Stack Overflow Stack Exchange Author: H.M Original post: https://stackoverflow.com/questions/72839931 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. Recently I want use all new features of c++(<=c++17) in MQL5 , Or using c++ stl containers , like std::map , std::vector. I can do something like this: creating a wrapper on them and compile them , hence using dll in mql5 But it's so bad idea , Can anyone suggest better way? thx for answer. I know that features like template overloading and more features should be suppoerted by meta trader code base , but they are so slow in this way , I wanna use new features in indirect way now, if it's possible.
Quote
Report
TheLegs · External communityPost link
External answer — Stack Overflow Stack Exchange Author: TheLegs Original post: https://stackoverflow.com/a/79950469 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. If the goal is to use the functionalities, not the exact same syntax, then MQL5 has two things that might be of interest: Matrices and vectors are available natively , plus There is a Standard Library available, which includes hashmaps and queues. For example: #include <Generic\HashMap.mqh> class RunResults { public: double p[20]; double label[20]; }; CHashMap<uint, RunResults*> runs; template<typename T> double CalculateLoss(const T &p[], const T &label[]) { static vector<T> vp; vp.Assign(p); static vector<T> vl; vl.Assign(label); return vp.Loss(vl, LOSS_MSE); } double GetRunLoss(uint runId) { static RunResults* value; if(runs.TryGetValue(runId, value)) return CalculateLoss(value.p, value.label); else return NULL; } This comment on the MQL5 forum collects some more differences, with the caveat that some of these differences have been resolved in recent years.
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External answer — Stack Overflow Stack Exchange Author: TheLegs Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/a/79950469 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. If the goal is to use the functionalities, not the exact same syntax, then MQL5 has two things that might be of interest: Matrices and vectors are available natively , plus There is a Standard Library available, which includes hashmaps and queues. For example: #include <Generic\HashMap.mqh> class RunResults { public: double p[20]; double label[20]; }; CHashMap<uint, RunResults*> runs; template<typename T> double CalculateLoss(const T &p[], const T &label[]) { static vector<T> vp; vp.Assign(p); static vector<T> vl; vl.Assign(label); return vp.Loss(vl, LOSS_MSE); } double GetRunLoss(uint runId) { static RunResults* value; if(runs.TryGetValue(runId, value)) return CalculateLoss(value.p, value.label); else return NULL; } This comment on the MQL5 forum collects some more differences, with the caveat that some of these differences have been resolved in recent years.

Cancel quote

Checking account access…