shared_ptr::operator->返回的是T*类型指针,非const T*指针。因此通过const shared_ptr&类型的ptr可以直接调用T各个原始的方法,不用担心const与非const问题。具体shared_ptr::operator->实现如下,摘自boost1.52.0版本...
分类:
其他好文 时间:
2014-07-09 23:34:42
阅读次数:
194
C++ string类的成员函数,用于拷贝、赋值操作,它们允许我们顺次地把一个string 对象的部分内容拷贝到另一个string 对象上。string &operator=(const string &s);把字符串s赋给当前字符串string &assign(const char *s);用c类...
分类:
编程语言 时间:
2014-07-09 23:22:50
阅读次数:
287
When you use an arithmetic operator, the operands go through two conversions.Integer promotions: If int can represent all values of the type, then the...
分类:
编程语言 时间:
2014-07-09 13:46:00
阅读次数:
278
man bash: Special Parameters The shell treats several parameters specially. These parameters may only be referenced; assignment to them is not allowed...
分类:
其他好文 时间:
2014-07-08 11:40:44
阅读次数:
313
通过蒙特卡洛模拟方法来估计渗流阈值。 Percolation. 给一个有随机分布的绝缘和金属材料的组成的复合系统。例如我们想知道哪些部分必须是金属材料才能让这个复合系统是一个电导体。或者在一个多孔的地形,在表面有水或者油,在什么情况下水或者油能够从最表面渗透到最底层。科学家把这种过程的模型叫做Per...
分类:
其他好文 时间:
2014-07-07 09:13:09
阅读次数:
400
如题,做报表时候,有时候要根据是否是合计行,来改变合计行的粗细,大小。可以通过字体的表达式来实现:表达式的通用写法: =iif( Fields!YourFieldName.Value operator "Value to compare", "If condition is met, use thi...
分类:
其他好文 时间:
2014-07-07 00:28:07
阅读次数:
201
模板友元函数在类内声明类外定义时都必须加模板前缀,另外模板要写在一个文件内// generates undefined error for the operator#include #include template class array { int size;public: array(); t...
分类:
编程语言 时间:
2014-07-06 19:56:39
阅读次数:
199
非强制性,但是个好习惯当使用连锁赋值时很有用x=y=z=10;class Window{ public: Window& operator=(int size) { ... return *this; }}这个规则适用于 -,+, +=,-= etc
分类:
编程语言 时间:
2014-07-06 16:14:49
阅读次数:
264
Divide two integers without using multiplication, division and mod operator.思路:不能使用乘法除法以及取模运算来计算两个数相除。主要做法就是,将因子不断乘2(向左移位即可实现),同时结果从1不断移位加倍,等到除数大于被除数一...
分类:
其他好文 时间:
2014-07-06 15:34:24
阅读次数:
197
Divide two integers without using multiplication, division and mod operator.不用乘、除、求余操作,返回两整数相除的结果,结果也是整数。假设除数是2,相除的商就是被除数二进制表示向右移动一位。假设被除数是a,除数是b,因为不知...
分类:
其他好文 时间:
2014-07-05 20:37:18
阅读次数:
193