- auto_ptr
- Supported in C++ Standard Library
- Support Ownership Transfer
- scoped_ptr
- Supported in C++ TR1
- Not Support Ownership Transfer
- shared_ptr
- Supported in C++ TR1
- Using Reference Count
- Object copy or assignment will increase the reference count.
- weak_ptr
- Supported in C++ TR1
- Created from shared_ptr. Cannot be created alone.
- Support Ownership Transfer
- Easy and safe to check a pointer valid or not, without increasing the reference count.
延伸閱讀:
1 comment:
強
Post a Comment