#include<iostream>//头文件
#pragmaonce
usingnamespacestd;
classString
{
public:
String(char*str="\0");
~String();
String(constString&str);
voidCout();
char&operator[](size_tindex);
Stringoperator+(constString&str);
Stringoperator=..
分类:
编程语言 时间:
2015-11-29 06:54:53
阅读次数:
179
专题基本全都是模版应用。贴一下模版const double eps = 1e-8;const int INF = 0x3f3f3f3f;int sgn(double x){ if (fabs(x) operator & (const Line &b) const { Po...
分类:
其他好文 时间:
2015-11-28 18:18:49
阅读次数:
280
namespace Chapter11{ public class AddClass1 { public int val; public static AddClass3 operator +(AddClass1 op1, AddClass2 op2) {...
我们知道隐式变换在可控情况下会使代码变得简洁。熟悉C#的都知道C#中可以自定义隐式变换,例如public class A{ private int data; public static implicit operator A(int i) { return ...
分类:
其他好文 时间:
2015-11-24 14:26:15
阅读次数:
182
最终出错的位置是:#defineLUABIND_OPERATOR_ADL_WKND(op)\inlinebooloperatorop(\basic_iteratorconst&x\,basic_iteratorconst&y)\{\returnboost::operatorop(x,y);\}\\i...
分类:
其他好文 时间:
2015-11-24 01:09:24
阅读次数:
582
1 list () 定义2 dict() 转化为字典3 tuple() 转化为元组4 sort() 和 sorted()区别5 a.sort(key=lambda x:x[1],reverse=true) #以集合中第二项为基准排序 然后反转6 import operator a...
分类:
编程语言 时间:
2015-11-23 18:45:23
阅读次数:
142
条件选择:if…else…fi case…in…esac数值比较操作符符号说明-eq等于-ne不等于-gt大于-lt小于-ge大于等于-le小于等于如运行报错:[: -le: unary operator expected究其原因,是因为如果变量值为空,那么就成了 [ = 数值,而[和数值并不相等....
分类:
其他好文 时间:
2015-11-23 16:26:34
阅读次数:
134
迷宫问题,还非得用一下栈T_T 1 #include 2 #include 3 #include 4 using namespace std; 5 const int Max=1000; 6 struct point 7 { 8 int x,y; 9 bool operator...
分类:
其他好文 时间:
2015-11-21 00:26:37
阅读次数:
233
令operator=返回一个reference to *this将operator=返回一个reference是为了什么呢?答案很简单,就是为了实现连锁形式。什么是连锁形式,如int x,y,z;x=y=z=15;这种形式就是连锁形式。声明一下。这只是个大家一致同意的写法。你也可以不遵守这种写法。可...
分类:
编程语言 时间:
2015-11-20 16:58:36
阅读次数:
160
operator new和operator delete函数有两个重载版本:1 void* operator new (size_t); // allocate an object 2 void* operator new [] (size_t); // allocate an ...
分类:
其他好文 时间:
2015-11-20 12:32:01
阅读次数:
198