码迷,mamicode.com
首页 >  
搜索关键字:operator overloading    ( 3732个结果
matlb
swt.m: 1 function [ swtMap ] = swt( im, searchDirection ) 2 %swt Preforms stoke width transform on input image 3 % A novel image operator that se...
分类:其他好文   时间:2014-07-19 19:35:50    阅读次数:287
Bit operator: Left shift and Right shift (Signed or unsigned? )
No matter left shift or right shift, the result's sign should always be the same as its left operand. By default, const numbers in C/C++ is signed. -Wsign-compare {      unsigned int j = 3;      ...
分类:其他好文   时间:2014-07-16 12:59:21    阅读次数:238
作用域指针(三)
作用域指针 当我们并不打算复制智能指针,只是想保证被分配的资源将被正确地回收,可以采用一种简单得多的解决方案:作用域指针。如下示例代码: 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
Effective C++ Item 41 了解隐式接口和编译期多态
经验:class 和 templates 都支持接口和多态。 对 classes 而言接口是显式的,以函数签名为中心。多态则是通过 virtual 函数发生于运行期 对 templates 参数而言,接口是隐式的,奠基于有效表达式。多态则是通过 templates 具体化和函数重载解析(function overloading resolution)发生于编译期。 示例1:显式接口和运行期多态 class Widget{ public: Widget(); virtual ~Widget(); vir...
分类:编程语言   时间:2014-07-14 12:54:57    阅读次数:195
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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!