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
如题,做报表时候,有时候要根据是否是合计行,来改变合计行的粗细,大小。可以通过字体的表达式来实现:表达式的通用写法: =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
有许多时候,我们自己编写类的operator=函数(例如,当类中包含指针时)。
考虑如下的一个类:
class Widget {
public:
Widget(int x=0): val(new int(x)) {}
~Widget() { delete val; }
Widget(const Widget &rhs): val(new int(*rhs.val)) {}
//...
分类:
其他好文 时间:
2014-07-02 09:08:20
阅读次数:
188
让编译器进行隐式类型转换所造成的弊端要大于它所带来的好处,所以除非你确实需要,不要定义类型转换函数。隐式类型转换的缺点:它们的存在将导致错误的发生。例如:class Rational {public: ... operator double() const; // 转换Rational类成doubl...
分类:
其他好文 时间:
2014-07-02 00:09:52
阅读次数:
261
google hacking事实上并算不上什么新东西,当时并没有重视这样的技术,觉得webshell什么的,并无太大实际用途.google hacking事实上并非如此简单... 经常使用的googlekeyword: foo1 foo2 (也就是关联,比方搜索xx公司 xx美女) operator...
分类:
其他好文 时间:
2014-06-30 22:50:28
阅读次数:
353