2012年6月3日
摘要: 重载操作符:具有特殊名称的函数,保留字operator后接需要定义的操作符符号Sales_item operator+(const Sales_item&,const Sales_item&);//声明了Sales_item类间的加法操作重载操作符必须具有至少一个类类型或枚举类型的操作数;这条规则强制重载操作符不能重新定义用于内置类型对象的操作符定义,即:int operator+(int,int);//error 错误的除了函数调用操作符operator()之外,重载操作符时使用默认实参是非法的type operator ()(....,int i=100,.......){ 阅读全文
posted @ 2012-06-03 21:47 nkxyf 阅读(664) 评论(0) 推荐(0) 编辑
摘要: 算法简介 标准库定义了 100多个算法,要学习如何使用它们,需要理解它们的结构,而不是记住每个算法的细节 ( 1)查找对象的算法: find(beg,end,val) count(beg,end,val) find_if(beg,end,unaryPred) count_if(beg,end,unaryPred) find_first_of(beg1,end1,beg2,end2) find_first_of(beg1,end1,beg2,end2,binaryPred) find_end(beg1,end1,beg2,end2) find_end(beg1,end1,be... 阅读全文
posted @ 2012-06-03 21:19 nkxyf 阅读(4836) 评论(0) 推荐(0) 编辑