Even changing to a bit more sensible script, same result. Compiler goes mad.
//+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ class CItem { public: string m_name; CItem(string name) {m_name=name;} string Name() {return(m_name);} }; template<typename T> class CCollection<T> { public: T m_data[]; bool Add(T item); CCollection<T> *Get(); }; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ template<typename T> bool CCollection::Add(T item) { ArrayResize(m_data,ArraySize(m_data)+1); m_data[ArraySize(m_data)-1)=item; return(true); } template<typename T> CCollection<T> CCollection::Get() { return(GetPointer(this)); } //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- CCollection<CItem *> c; }
Amir Yacoby:
Even changing to a bit more sensible script, same result. Compiler goes mad.
You have 3 errors/typos.
//+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ class CItem { public: string m_name; CItem(string name) {m_name=name;} string Name() {return(m_name);} }; template<typename T> class CCollection { public: T m_data[]; bool Add(T item); CCollection<T> *Get(); }; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ template<typename T> bool CCollection::Add(T item) { ArrayResize(m_data,ArraySize(m_data)+1); m_data[ArraySize(m_data)-1]=item; return(true); } template<typename T> CCollection<T> *CCollection::Get() { return(GetPointer(this)); } //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- CCollection<CItem *> c; }
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Any ideas?