[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CppScopedPtr
Differences with the std::auto_ptr are:
! A difficult error to spot!
If you want to make sure the condition above is true, use a boost::scoped_ptr. It will detect this at compile-time.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
CppScopedPtr
(C++) boost::scoped_ptr
The boost::scoped_ptr is a smart pointer supplied by the Boost C++ Library. It shared many characteristic with the std::auto_ptr.Differences with the std::auto_ptr are:
- A boost::scoped_ptr cannot be copied
- A boost::scoped_ptr has a checked delete
About the checked delete (advanced)
When you make use of forward declaration and make a pointer to a forward declared class, you have to make sure that the destructor of this class is known at run-time. This, however, does not yield a compile-error, but in undefined behaviourIf you want to make sure the condition above is true, use a boost::scoped_ptr. It will detect this at compile-time.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
