Smart Pointer that supports subclassing - 项目摘要 |
摘要
| 管理 |
论坛 文档
| 软件包 |
|
|
|
项目描述: |
Until now all smart pointer implementations that I have seen didn't support assignment between base and derived class pointers. Here is an implementation that does support it. I give you two implementations of smart pointers:
1) Ptr - This smart pointer assumes that 'T' support reference counting by deriving from IRefCount (which is also supplied).
2) SmartPtr - This smart pointer is more generic than Ptr while not assuming anything about the type 'T'. Being more generic costs having a small reference object created for each referenced object or type.
直到目前我所见到过的所有的智能指针不支持基类和派生类指针间的赋值。这里是支持这一功能的实现。我给出了智能指针的两个实现:
1) Ptr -这个智能指针假设通过派生自IRefCount 来支持引用计数。
2) SmartPtr - 这个智能指针比Ptr 更通用,没有对 'T'进行任何假设。为了支持更多的通用性,只能让每个引用对象或类型创建更少的引用对象。
来源: http://www.codeguru.com/cpp_mfc/smartPtrEfrati.shtml |
类别: |
|
发布者:
cbd002
|
|
最新发布源码包 |
软件包 |
版本号 |
日期 |
本地下载 |
smartPtrEfrati |
 1.0  |
2004-04-09 |
下载 |
|
|