注意几点: 分配内存不要使用new和delete,因为new的同时就把对象构造了,而我们需要的是原始内存。 所以应该使用标准库提供的allocator类来实现内存的控制。当然也可以重载operator new操作符,因为二者都是使用malloc作为底层实现,所以直接采用malloc也可以。 对象的复...
分类:
其他好文 时间:
2014-09-29 00:11:26
阅读次数:
303
今天看《C++ Primer》的13.1节——Copy, Assign, and Destroy
被这几个玩意儿弄得晕得不行:
◆ Copy Constructor
◆ The Copy-Assignment Operator
◆ Destructor
主要问题集中在:
◆ 我们在什么时候需要自己重写?...
分类:
其他好文 时间:
2014-09-29 00:05:26
阅读次数:
319
首先我们来看一下错误信息:Error Domain=AFNetworkingErrorDomain Code=-1011 "Expected status code in (200-299), got 406"{ status code: 406,headers { "Content-Languag...
分类:
Web程序 时间:
2014-09-27 15:54:19
阅读次数:
280
主要有一下四种方式1.Bpublic继承自A;calss B : public A{ ... }2.在A中写参数为B的复制构造函数calss A{ A(const B &b); }3.重写A的=operatorA & operator(const B& );
分类:
编程语言 时间:
2014-09-26 23:59:08
阅读次数:
229
1 class Empty 2 { 3 public: 4 Empty(); 5 Empty(const Empty&); 6 ~Empty(); 7 Empty & operator =(const Empty &); 8 Empt...
分类:
编程语言 时间:
2014-09-26 23:47:08
阅读次数:
233
类型转换操作符(type conversion operator)是一种特殊的类成员函数,它定义将类类型值转变为其他类型值的转换。转换操作符在类定义体内声明,在保留字 operator 之后跟着转换的目标类型。class CVImage{public : CVImage(); explicit .....
分类:
编程语言 时间:
2014-09-26 20:49:38
阅读次数:
163
1)改变oracle 11g r2 中sql developer中查询出来的结果的日期显示类型,即会话日期类型的设置:
alter session set nls_date_format = 'YYYY-MM-DD HH24:MI:SS';
oracle加字段:
alter table operator_daily add(op_type number(11));
2)函数de...
分类:
数据库 时间:
2014-09-26 13:05:28
阅读次数:
209
C 中delete表达式执行的操作是:1,调用析构函数;2,释放对象内存(operator delete(…))。 如果父类的析构函数没有声明为virtual函数,且子类中至少存在一个virtual函数,此时将子类的对象地址赋值给父类指针。当对父类的指针执行delete操作时,会调用父类析构函数,然...
分类:
其他好文 时间:
2014-09-25 18:51:47
阅读次数:
171
#-*- encoding=utf-8 -*- import operator #按字典值排序(默认为升序) x = {1:2, 3:4, 4:3, 2:1, 0:0} sorted_x = sorted(x.iteritems(), key=operator.itemgetter(1)) print sorted_x #[(0, 0), (2, 1), (1, ...
分类:
编程语言 时间:
2014-09-25 00:33:38
阅读次数:
290
第五十一题Write a C function which does the addition of two integers without using the '+' operator. You can use only the bitwise operators.(Remember the g...
分类:
其他好文 时间:
2014-09-24 00:51:55
阅读次数:
253