下载MetaTrader 5

求助:mq4使用模板涵数,发生internal error #-1005错误

要添加评论,请登录注册
344720115
85
344720115 2014.11.03 20:10 

mqh文件如下:(编写通过)

  

class Int{

     public:

     int arr[];

    ~Int(){ArrayFree(arr);};

  }; 

class CAyyInt

  {

    private:

      //template<typename T>

      //T     m_ayy[];

      int     m_gesu;//数组元素个数

    public:

      Int *inT;

      CAyyInt()                                {ayy=GetPointer(this);m_gesu=-1;};

      CAyyInt(CAyyInt &n)                      {ayy=GetPointer(this);m_gesu=-1;};//复制构造涵数

     ~CAyyInt()                                {delete inT;};

      void leixing(const string st){if(st=="int")inT=new Int;};// int a=0 ;ArrayResize(a);};

      //bool ArraySetAsSeries(const bool flag=true){return ArraySetAsSeries(m_ayy, flag);};//设置标记到选定的动态数组对象的函数,其元件如时间序列中一样被索引。true表示倒序索引

      CAyyInt *ayy;

      int     read(const int n)                {return inT.arr[n];};//读

      int     readgesu()                       {return m_gesu;};//读数组元素个数

      int     readZuidaXiaBiao()               {return m_gesu-1;};//读数组元素个数

      template<typename T>

      void    write(const int n,const T shu) 

        {if(n>=m_gesu)ArrayResize(n+1);inT.arr[n]=shu;};//写

      int ArrayResize(const T new_size)      {if(new_size!=m_gesu){m_gesu= ArrayResize(inT.arr,new_size); return m_gesu;} else return m_gesu;};

      T operator [](const int n){return read(n);};

      void operator=(const T shu)

        {write(m_gesu,shu);};

      //template<typename T> class A ;

  }; 

mq4文件如下:(编写通过)

#include <\zhibian\Arrays\Arr.mqh>

int OnInit()

  {

//--- create timer

   EventSetTimer(60);

      CAyyInt tu;

     //CAyyInt *tu=jj.ayy;

     int cc=0;

     tu.leixing("int");

     //tu.ArraySetAsSeries();

     int b=456;

     tu.write(0,b);

     b=123;

     tu.write(1,b);

     int dd;

     b=789;

     tu=b;

     dd=tu[2];

     CAyyInt h=tu;

     b=123;

     h.write(0,b);

     dd=h.read(0);

     dd=tu.read(0); 

  return(INIT_SUCCEEDED);

  }

但是调试时不运行,描述栏显示: internal error #-1005 0 0

请各位大师指导!先谢谢了!
要添加评论,请登录注册