码迷,mamicode.com
首页 >  
搜索关键字:operator-    ( 3564个结果
作用域指针(三)
作用域指针 当我们并不打算复制智能指针,只是想保证被分配的资源将被正确地回收,可以采用一种简单得多的解决方案:作用域指针。如下示例代码: template class ScopedPtr { public: explicit ScopedPtr(T* p = NULL) :ptr_(p) { } ScopedPtr& operator=(T* p) { if(ptr_ !...
分类:其他好文   时间:2014-07-16 11:45:30    阅读次数:311
hdu 4544 湫湫系列故事——消灭兔子 优先队列+贪心
将兔子的血量从小到大排序,箭的威力也从小到大排序, 对于每只兔子将威力大于血量的箭加入队列,写个优先队列使得出来数位价钱最少。。 #include #include #include #include #include using namespace std; const int maxn=100010; struct tt { int d; int p; bool operator<...
分类:其他好文   时间:2014-07-15 12:52:52    阅读次数:321
List exercise
The slice operator can take a third argument that determines the step size, so t[::2] creates a list that contains every other element from t. If the ...
分类:其他好文   时间:2014-07-15 09:12:42    阅读次数:328
Python中的sorted函数以及operator.itemgetter函数 【转载】
operator.itemgetter函数 operator模块提供的itemgetter函数用于获取对象的哪些维的数据,参数为一些序号(即需要获取的数据在对象中的序号),下面看例子。 a = [1,2,3]  >>> b=operator.itemgetter(1)      //定义函数b,获取对象的第1个域的值 >>> b(a)  2  >>> b=operator.item...
分类:编程语言   时间:2014-07-14 16:59:58    阅读次数:229
List operations
The + operator concatenates lists: Similarly, the * operator repeats a list a given number of items:List slicesThe slice operator also works...
分类:其他好文   时间:2014-07-13 19:42:02    阅读次数:208
linux下c++filter查看函数修饰名
c++函数在编译之后会变成类似下面的样子: _ZNK4Json5ValueixEPKc   在linux命令行使用c++filter: root@SSDEV016:~ $ c++filt _ZNK4Json5ValueixEPKc Json::Value::operator[](char const*) const   这样就得到函数的原始名称   如果没有安装c++filter...
分类:编程语言   时间:2014-07-12 19:09:48    阅读次数:234
【C++ Primer】重载操作符与转换
十四、重载操作符与转换 1. 重载操作符的定义 重载操作符必须具有至少一个类类型或枚举类型的操作数,这条规则强制重载操作符不能重新定义用于内置类型对象的操作符含义。 int operator +(int, int) // 错误,内置数据类型不能重载操作符 重载操作符,操作符的优先级、结合性或操作数数目不能改变。重载操作符并不保证操作数的求值顺序,不再...
分类:编程语言   时间:2014-07-12 17:06:11    阅读次数:329
STL函数对象和Lambda表达式
STL函数对象和Lambda表达式1.基本概念Function object是定义了operator()的object。FunctionObjectType fo;fo(…);调用函数对象的operator()代替函数fo()的调用。等价于:fo.operator()(…);函数对象的三个好处:(1...
分类:其他好文   时间:2014-07-11 09:59:40    阅读次数:182
Lists are mutable
The syntax for accessing the elements of a list is the same as for accessing the characters of a string – the bracket operator ([ ]). The expression i...
分类:其他好文   时间:2014-07-11 08:55:10    阅读次数:174
C++模板实现单向链表
模板实现头文件:#ifndef SUN_LINKLIST_H#define SUN_LINKLIST_H#include using namespace std ;//#include "List.h"// T : operator= , operator!= , operator== , cop....
分类:编程语言   时间:2014-07-10 16:23:14    阅读次数:220
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!