This might Compile
/* template <typename T> class Foo{}; template <typename barT,typename fooT> class Bar:public Foo<fooT>{}; void OnStart() { Bar<int,int> b; Bar<void*,int> b2; Bar<void*,const int> b3; Foo<const void *> f; // here is the problem: when set the tmplate type in Bar to "const void *", some compile error // 'T' - unexpected token // '<' - wrong template parameters count Bar<const void *,Foo<const void *>> b4; } */ template<typename T> class Foo{}; template<typename T> class Bar:public Foo< T >{}; void OnStart() { Bar<int> b; Bar<Foo<int>> b2; Bar<const Foo<int>* > b3; Foo<const void *> f; // here is the problem: when set the tmplate type in Bar to "const void *", some compile error // 'T' - unexpected token // '<' - wrong template parameters count Bar<Foo<const void*>> b4; }
This might Compile
It will not work anyway with a real implementation. void pointer are not allowed in mql.
curious what the OP needs it for though (first thought was a custom charting library )
curious what the OP needs it for though (first thought was a custom charting library )
It will not work anyway with a real implementation. void pointer are not allowed in mql.
class Foo{}; long GetAddress(const void *pointer) { return long(StringFormat("%I64d",pointer)); } void OnStart() { Foo* f = new Foo; Print(GetAddress(f)); delete f; }this works
curious what the OP needs it for though (first thought was a custom charting library )
I'm wrinting a SharedPointer class, need a global pointer counter container to storage the pointer reference counter, and this container is something like HashMap<void *, int>.
it works in Mql4, but failed when migrate to Mql5.
I was curious to know since when this undocumented (to my knowledge) feature is available : it's actually very old (Build
1395 2016.08.18), I completely missed that.
- 2015.10.29
- www.mql5.com
I'm wrinting a SharedPointer class, need a global pointer counter container to storage the pointer reference counter, and this container is something like HashMap<void *, int>.
it works in Mql4, but failed when migrate to Mql5.
Hmm, im not that advanced ,so the goal is to be able to instantiate global class objects from within functions on runtime ?
I'm wrinting a SharedPointer class, need a global pointer counter container to storage the pointer reference counter, and this container is something like HashMap<void *, int>.
it works in Mql4, but failed when migrate to Mql5.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Need help. When I migrate my mql4 lib to mql5, but come to a problem I can't solve. here is the code that recreate the problem.
But I do need this language property in my library. Can anyone help me?