CArray<float,float>m_nodeLevel;
CArray<int,int>m_nodeFrequency;
CArray<int,int>m_nodeTime;
三个数组如上定义
m_nodeLevel.SetSize(10,10);
m_nodeTime.SetSize(10,10);
m_nodeFrequency.SetSize(10,10);
三个数组设置大小
调用下面这三句添加数据时就出错了,访问某某区域出错,谁能帮我看看为什么
m_nodeLevel.InsertAt(m_nowNode,0,1);
m_nodeTime.InsertAt(m_nowNode,0);
m_nodeFrequency.InsertAt(m_nowNode,20);

解决方案 »

  1.   


    m_nodeLevel.InsertAt(0,m_nowNode);//0是第一个数据
      

  2.   

    不一定是0,但你要确保m_nowNode是个有效值
      

  3.   

    你这么说提醒了我,我去看了下却是不是有效值,但是新的问题出现了,我的类中有个私有成员
    int m_nowNode;
    在默认的构造函数中我将它的值置为了-1,然后调用了一个有参数的重载的构造函数,这样在构造函数中调用构造函数是不是不行?在有参数的构造函数中,我再使用m_nowNode时发现它不是-1,而是一个默认很大的负数
    CEQShade::CEQShade()
    {
    m_nowNode=-1;
     CEQShade(1,1,1);//
    }
    CEQShade::CEQShade(int newBelongCurtainMark,int newBelongSceneMark,int newBelongScapeMark)
    {
    m_nowNode=m_nowNode+1;//这个时候它不是-1了,刚在上面才置为-1的,为什么?帮忙看看
    }
      

  4.   


    // example for CArray::InsertAtCArray<CPoint,CPoint> ptArray;ptArray.Add(CPoint(10,20));   // Element 0
    ptArray.Add(CPoint(30,40));   // Element 1 (will become element 2)
    ptArray.InsertAt(1, CPoint(50,60));   // New element 1