CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

binary_function的问题

楼主erictb(erictb)2005-07-03 19:34:21 在 VC/MFC / 基础类 提问

////////////////////////////////////////////  
  //  
  //   Compile   options   needed:   /GX  
  //  
  //   binfunc.cpp   :   Illustrating   the   binary_function  
  //                               structure.  
  //  
  //   Structure   used:   binary_function<A,B,C>   -   base  
  //                                   class   used   to   create   operator  
  //                                   functions   taking   data   types   A  
  //                                   and   B   and   returning   data   type   C.  
  ////////////////////////////////////////////  
   
  #include   <functional>  
  #include   <iostream>  
   
  using   namespace   std   ;  
   
  class   binary_test   :   public   binary_function<binary_test   &,int,float>  
  {  
  public:  
      float   value;  
      binary_test(){value=10.0;}  
      binary_test(float   x){value=x;}  
      result_type   operator<<(second_argument_type   arg2);  
  };  
   
  binary_test::result_type  
  binary_test::operator<<(binary_test::second_argument_type   arg2)  
  {  
      value   =   ((int)value)   <<   arg2;  
      cout   <<   "New   value   after   shift   is"   <<   value   <<   endl;  
      return   value;  
  }  
   
  void   main(void)  
  {  
      binary_test   item;  
   
      cout   <<   "Begin"   <<   endl;  
      item   =   item   <<   2;  
      ///这里item   <<   2的返回值的类型是float,但这个表达式的左边是binary_test,这里怎么没有编译出错呢?  
  }  
  问题点数:20、回复次数:1Top

1 楼xqk(夏乾坤)回复于 2005-07-03 20:29:26 得分 0

upTop

相关问题

  • PDF Binary Format
  • Binary类型??????
  • TimeStamp和Binary(8)
  • Binary Search Tree
  • This PHP CGI binary was compiled
  • What does binary stream mean?
  • DC转换为Binary?
  • binary 类型的存取
  • 关于 Binary 的问题?
  • Binary 如何表示权限

关键词

  • binary
  • function
  • test
  • type

得分解答快速导航

  • 帖主:erictb

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo