码迷,mamicode.com
首页 >  
搜索关键字:operator-    ( 3564个结果
poj2431 Expedition
直接代码、、、 #include #include #include #include #include using namespace std; struct node { int fuel,dist; //bool operator d.dist; // } }s[10005]; ...
分类:其他好文   时间:2014-07-22 22:34:14    阅读次数:178
从for_each开始说起 回调函数与仿函数
#include?<iostream> #include?<algorithm> using?namespace?std; //回调函数 void?call_back(char?elem) { ?cout?<<?elem?<<?endl; } //仿函数 struct?Functor { ?void?operator()?(char?elem)...
分类:其他好文   时间:2014-07-22 08:13:37    阅读次数:316
STL源码剖析 容器 stl_deque.h
deque ------------------------------------------------------------------------ ??一直看不懂 operator->() ,不明白它为什么不用接受参数,直接 return &(operator*()) 好像我们用迭代器的时候也不没怎么用到这个函数,甚至我都不会用 1.概述 vector 是单向开口的连续线性空间,deque 则是一种双向开口的连续线性空间 允许常数时间内对起头端进行元素的插入和移除操作 没有容量概念,因为它是动...
分类:其他好文   时间:2014-07-22 00:32:34    阅读次数:225
Android Studio "diamond operator is not supported" 处理方法
低版本的android编译环境是不支持使用java7语法的,如果使用了,就会产生上述问题,如果你的android环境较新,那么可以使用以下方法:在build.gradle的android标签下加入以下代码 compileOptions { sourceCompatibility Jav...
分类:移动开发   时间:2014-07-22 00:20:34    阅读次数:281
hdu--1242--bfs+优先队列
回家后 第一题~~纯粹的 Bfs + priority_queue碰到这种 什么打个怪 多耗1min 果断都是 优先队列就和 南阳 有个 坦克大战 一样别忘了 优先队列 结构体存储时候 重写 operator 2 #include 3 #include 4 using namespace st...
分类:其他好文   时间:2014-07-22 00:00:36    阅读次数:260
C++primer读书笔记9转换与类类型
有时候指定了自己类类型来表示某种类型数据如SmallInt,那么为了方便计算就会指定一个转换操作符,将该类类型在某种情况下自动的转换为指定的类型 转换操作符 operator type(); 转换函数必须是类成员函数,不能指定返回类型,并且形参列表必须为空,并且通常不应该改变转换对象,所以操作符通常定义为const成员。 #include using namespace std; cla...
分类:编程语言   时间:2014-07-21 13:32:27    阅读次数:181
hdu 1896 Stones(优先队列)
# include # include # include using namespace std; struct node { int pos; int d; int num; friend bool operator n2.d;//仍的距离从小到大 return...
分类:其他好文   时间:2014-07-21 11:43:44    阅读次数:180
【足迹C++primer】49、重载,转换,运算符
重载,转换,运算符 Conversion Operators 转换操作符 operator type() const Conversions to an array or a function type are not permitted. 转换函数必须是成员函数,不能指定返回 类型,必须有一个空的参数列表。 函数通常应 const。 Defining a Clas...
分类:编程语言   时间:2014-07-21 11:42:56    阅读次数:227
用3种方法在 operator= 中处理“自我赋值”
假设你建立一个class 用来保存一个指针指向一块动态分配的位图。1 class Bitmap {......};2 class Widget{3 ...4 private:5 Bitmap* pb ;6 };1 Widget& Widget::operator= (con...
分类:其他好文   时间:2014-07-21 08:39:10    阅读次数:145
STL源码剖析 容器 stl_vector.h
vector ---------------------------------------------------------------------- 描述: 1.迭代器 vector 维护的是一个连续线性空间,它的迭代器是普通指针, 能满足 RandomAccessIterator 所有必要条件:operator*, operator->,operator++,operator--,operator+, operator-,operator+=,operator-=,operator[] 2.数据...
分类:其他好文   时间:2014-07-20 23:25:57    阅读次数:378
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!