当前位置:首页 » 软件行业

自定义结构体数组无法用Copy或Append整体赋值,怎么办?

八月 3, 2007

 发表在: java



c:\program   files\microsoft   visual   studio\vc98\mfc\include\afxtempl.h(86)   :   error   c2679:   binary   =   :   no   operator   defined   which   takes   a   right-hand   operand   of   type   const   struct   tagtrainstoptime   (or   there   is   no   acceptable   conversion)  
  (*pdest++   =   *psrc++;)//指向此处语句。  
  自定义结构体:  
  typedef   struct   tagtrainstoptime  
  {  
   
  float   fupendx;  
  float   fdnendx;  
  float   fdndummyendx;  
  carray<float,float>   arrstoptimesx;//存储x坐标即时间  
  carray<cstring,cstring>   arrstoptimes;  
  tagtrainstoptime()  
  {  
  fupendx=0;  
  fdnendx=0;  
  fdndummyendx=0;  
  arrstoptimesx.setsize(0);  
  arrstoptimes.setsize(0);  
   
  };  
  tagtrainstoptime(tagtrainstoptime&   t)  
  {  
  fupendx=t.fupendx;  
  fdnendx=t.fdnendx;  
  fdndummyendx=t.fdndummyendx;  
  arrstoptimesx.copy(t.arrstoptimesx);  
  arrstoptimes.copy(t.arrstoptimes);  
  };  
  void   operator=(tagtrainstoptime&   t)  
  {  
  fupendx=t.fupendx;  
  fdnendx=t.fdnendx;  
  fdndummyendx=t.fdndummyendx;  
  arrstoptimesx.copy(t.arrstoptimesx);  
  arrstoptimes.copy(t.arrstoptimes);  
   
  };  
  }trainstoptimes;  
  carray<trainstoptimes,trainstoptimes> train1;  
  carray<trainstoptimes,trainstoptimes>     train2;  
  train2.copy(train1);或  
  train2.append(train1);均会产生该问题。  
  原来连add函数都无法使用,在未增加自定义构造函数和=重载函数之前。

电脑软件技术推荐:

  • 用物流理念发展物流产业[详细内容]
  • 神雕侠侣炒股篇(55)--盘中对比“强字诀”选中600158中体产业[详细内容]
  • 微软公司与上海合作发展软件产业[详细内容]
  • 中国C网与TCL联手,拓展民族信息产业[详细内容]
  • 上海确定优先发展的高科技产业[详细内容]
  • 信息产业成为宁波经济发展支柱产业[详细内容]
  • 宫玉国论谈在线产业和离线产业[详细内容]
  • 印度为互联网产业[详细内容]
  • 大连大力发展信息产业[详细内容]
  • 首钢:8亿巨资投入非钢产业[详细内容]
  • 相关提议:
    发表者:newbiestar

    怀疑你等号两边的类型不一样,两个相同类型的是没有问题的

    .

    No comments in this entry


    Post a Comment »

    Logged in

    Advertising

    Categories

    相关文章