http://blog.csdn.net/u011265346/article/details/44906469#include#includeusing namespace std;#define N 401struct Point{int p,v;}a[N];bool operator < (c...
分类:
其他好文 时间:
2015-06-24 10:41:31
阅读次数:
95
所谓的适配器就是底层利用仿函数,然后修改仿函数的接口,达到自己的目的;例如:templateclass binder1st的适配器,其本质是一个类,它的模板参数operation其实是仿函数类(仿函数其实是struct类),内部函数调用operator()(const typename Operat...
分类:
其他好文 时间:
2015-06-23 23:10:14
阅读次数:
135
在CENTOS6下安装LINUX后,可能会有以下的崩溃消息:eclipse:cairo-misc.c:380:
_cairo_operator_bounded_by_source:Assertion`NOT_REACHED‘
failed.这是由于cario版本中的bug造成的,如果gtk2的版本大于2.24,并且cario的版本小于1.9.4,就会有这种现象。在网上找到找到如下的..
分类:
系统相关 时间:
2015-06-23 18:12:27
阅读次数:
292
在operator=中处理“自我赋值”什么是自我赋值,很明显。就是自己的值赋值给了自己。下面的代码就是自我赋值:class Widget
{
public:
Widget& operator=(const Widget& rhs)
{
delete p;
p=new int(ths.p);
return *this;
}...
分类:
编程语言 时间:
2015-06-23 10:17:26
阅读次数:
131
复制对象时,勿忘其每一个成分作者在本节条款提醒我们,在多重继承的情况下进行copy或者copy assignment 的operator=的编写时,一定要考虑base 类部分数据的初始化后者复制。对比一下代码:class Cutsomer
{
……
private:
string name;
string telphone;
};
class PriorityCustomer:pub...
分类:
编程语言 时间:
2015-06-23 10:12:51
阅读次数:
113
Comparing with the 'I' one, there are two changes:1. if last operator is "+" or "-", we don't evaluate expression2. if last operator is "*" or "/", we...
分类:
其他好文 时间:
2015-06-22 13:37:36
阅读次数:
425
1:将/etc/passwd中有root字符的行显示出来1 [root@bogon zkero]# grep -n 'root' /etc/passwd2 1:root:x:0:0:root:/root:/bin/bash3 11:operator:x:11:0:operator:/root:/sb...
分类:
系统相关 时间:
2015-06-22 07:32:45
阅读次数:
200
class mypoint{
var x:Int =1;
var y:Int =1;
init(#x:Int,#y:Int){
self.x = x;
self.y = y;
}
var description:String{//在这里稍有贪心,做一描述成员get变量
get{
ret...
分类:
编程语言 时间:
2015-06-21 18:37:48
阅读次数:
139
hash结构体
struct Hash_map
{
static const int mask=0x7fffff;
int p[8388608],q[8388608];
void clear(){
for(int i=0;i<=mask;++i)
q[i]=0;
}
int & operator [...
分类:
其他好文 时间:
2015-06-21 09:28:10
阅读次数:
130
#include using namespace std;class num{public: num(){n=new int;*n=1;coutx=a.x;cout two.operator =(one); cout<<two.getX()<<endl; retur...
分类:
编程语言 时间:
2015-06-20 23:29:40
阅读次数:
235