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

CList::Find的问题,请教

八月 3, 2007

 发表在: java



大概的代码如下:  
  typedef   struct   t_dll_list  
  {  
  char   szdllname[200];  
  hinstance   *hinst;  
  }dll_list_t;  
   
  clist<t_dll_list,   t_dll_list&>   list;    
   
  但是在用find方法的时候有问题.  
   
   
  position   searchchains(char*   pdllname)//  
  {  
  t_dll_list   tt;  
  strcpy(tt.szdllname,pdllname);  
  return   list.find(tt,null);  
  }  
   
  错误是:  
  --------------------configuration:   testdlg   -   win32   debug--------------------  
  compiling...  
  testdlgdlg.cpp  
  d:\program   files\microsoft   visual   studio\vc98\mfc\include\afxtempl.h(122)   :   error   c2678:   binary   ==   :   no   operator   defined   which   takes   a   left-hand   operand   of   type   const   struct   t_dll_list   (or   there   is   no   acceptable   conversion)  
                  d:\program   files\microsoft   visual   studio\vc98\mfc\include\afxtempl.h(1036)   :   see   reference   to   function   template   instantiation   int   __stdcall   compareelements(const   struct   t_dll_list   *,const   struct   t_dll_list   *)   being   compiled  
  generating   code...  
  compiling...  
  testdlg.cpp  
  generating   code...  
  error   executing   cl.exe.  
   
  testdlg.exe   -   1   error(s),   0   warning(s)  
   
  请问各位,怎么解决?谢谢  
 

电脑软件技术推荐:

  • 黑客技术:木马是如何编写的(二)[详细内容]
  • 用VB6编写强力的windows隐藏引擎[详细内容]
  • 利用VB编写屏幕保护程序[详细内容]
  • 使用UML编写Java应用程序[详细内容]
  • 使用WML和ASP编写动态手机页面[详细内容]
  • Linux网络驱动程序编写(四)[详细内容]
  • Linux网络驱动程序编写(二)[详细内容]
  • 用VB编写异步多线程下载程序[详细内容]
  • unix下编写socket程序的一般步骤[详细内容]
  • 用VB编写接近实际的抽奖程序[详细内容]
  • 相关提议:
    发表者:happyparrot

    就是说,你这个list中的结构t_dll_list不支持==操作符。  
      因此,需要为这个结构增加==操作符函数  
      typedef   struct   t_dll_list  
      {  
      char   szdllname[200];  
      hinstance   *hinst;  
            bool   operator   ==(t_dll_list   tdl)  
            {  
                  if(strcmp(szdllname,tdl.szdllname)   !=   0)  
                          return   false;  
                  if(hinst   !=   tdl.hinst)  
                          return   false;  
                  return   true;  
       
            }  
      }dll_list_t;

    发表者:dentistrydoctor

    为t_dll_list实现一个operator==(cosnt   t_dll_list&   rhs)

    .

    No comments in this entry


    Post a Comment »

    Logged in

    Advertising

    Categories

    相关文章