智能指针的拷贝构造函数引发的矛盾 eiThingPtr( const eiThingPtr < T > & np) { ptr = np.ptr; auto_del = np.auto_del; np.auto_del = false; } 拷贝函数的参数非要定义成const,但是因为智能指针的特殊性,在拷贝中应该取消原指针对内存的管理,必须修改原指针的成员变量,由此产生矛盾。注意np.auto_del = false;这句和const的冲突! posted on 2005-08-16 20:17 Len3d 阅读( ...) 评论( ...) 编辑 收藏 转载于:https://www.cnblogs.com/len3d/archive/2005/08/16/216321.html