码迷,mamicode.com
首页 >  
搜索关键字:operator-    ( 3564个结果)
python reduce使用实例
通过一个简单的算法来了解reduce的巧用。构建函数persistence(n),如果n>9,则返回0.否则继续根据n的权重来分解n,如n=999,则分解为9,9,9.那么将9*9*9=729继续做以上判断,直到n 9: 5 n = reduce(operator.mul,[int(...
分类:编程语言   时间:2015-12-15 00:45:58    阅读次数:235
Thinking in Java,Fourth Edition(Java 编程思想,第四版)学习笔记四)之Operators
At the lowest level, data in Java is manipulated using operatorsUsing Java Operators An operator takes one or more argument and produces a new valu...
分类:编程语言   时间:2015-12-15 00:45:56    阅读次数:316
实战c++中的string系列--string的连接(+= or append or push_back)
string的连接也是经常用到的,string重载了一些运算符: 首先看一看重载+运算符,用于串联两个字符串对象: 源码:template basic_string operator+( const basic_string<C...
分类:移动开发   时间:2015-12-13 22:01:56    阅读次数:542
[Math]Divide Two Integers
otal Accepted:54356Total Submissions:357733Difficulty:MediumDivide two integers without using multiplication, division and mod operator.If it is overf...
分类:其他好文   时间:2015-12-13 21:56:26    阅读次数:267
实战c++中的string系列--string的遍历(使用下标还是iterator)
迭代器提供了访问容器中对象的方法。例如,可以使用一对迭代器指定list或vector中的一定范围的对象。迭代器就如同一个指针。事实上,C++的指针也是一种迭代器。但是,迭代器也可以是那些定义了operator*()以及其他类似于指针的操作符地方法的类对象.我们都知道可以用下标运算来访问string对象和vector对象。而另外还有一种更通用的方法也可以实现这样的方法。名曰:迭代器(iterator)...
分类:编程语言   时间:2015-12-12 01:43:17    阅读次数:442
[lintcode medium]Divide Two Integers
Divide Two IntegersDivide two integers without using multiplication, division and mod operator.If it is overflow, return 2147483647ExampleGiven divide...
分类:其他好文   时间:2015-12-11 06:51:41    阅读次数:148
C++11新特性之智能指针
1、shared_ptr:一种计数指针,被指向的对象在引用计数为0时删除。它表示共享的所有权(负责对象的删除销毁)。需要包含,下同。// 定义删除器struct Deleter{public: void operator() (Base *p) { cout p1(n...
分类:编程语言   时间:2015-12-06 01:47:46    阅读次数:208
【C/C++学院】0828-STL入门与简介/STL容器概念/容器迭代器仿函数算法STL概念例子/栈队列双端队列优先队列/数据结构堆的概念/红黑树容器
STL入门与简介 #include #include //容器 #include//数组 #include //算法 using namespace std; //实现一个类模板,专门实现打印的功能 template //类模板实现了方法 class myvectorprint { public: void operator ()(const T &t)//重载,使用(),打印 {...
分类:编程语言   时间:2015-12-02 12:38:26    阅读次数:301
C++箴言:理解 new-handler的行为
当 operator new 不能满足一个内存分配请求时,它抛出一个 exception(异常)。很久以前,他返回一个 null pointer(空指针),而一些比较老的编译器还在这样做。你依然能达到以前的目的(在一定程度上),但是我要到本文的最后再讨论它。 在 operator new 因回应一....
分类:编程语言   时间:2015-11-30 07:12:27    阅读次数:252
运算符重载(矩阵运算)
Matrix.h#include"Matrix.h" #includeusing namespace std;Matrix::Matrix(int r = 0,int c = 0){ row = r; column = c;}Matrix Matrix::operator+ (co...
分类:其他好文   时间:2015-11-29 09:25:41    阅读次数:201
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!