[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CppCheckedDelete
To cite from http://www.boost.org/libs/utility/checked_delete.html:
The C++ Standard allows, in 5.3.5/5, pointers to incomplete class types to be deleted with a delete-expression. When the class has a non-trivial destructor, or a class-specific operator delete, the behavior is undefined. Some compilers issue a warning when an incomplete type is deleted, but unfortunately, not all do, and programmers sometimes ignore or disable warnings.
In other words, if you use a lot of forward declarations you should prefer to use boost::checked_delete.
Note that std::auto_ptr does NOT use a checked delete! When you really need a checked delete, use boost::scoped_ptr instead (but note that boost::scoped_ptr has a slightly different interface then std::auto_ptr).
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
CppCheckedDelete
(C++) boost::checked_delete
A checked version of delete supplied with the Boost C++ library.To cite from http://www.boost.org/libs/utility/checked_delete.html:
The C++ Standard allows, in 5.3.5/5, pointers to incomplete class types to be deleted with a delete-expression. When the class has a non-trivial destructor, or a class-specific operator delete, the behavior is undefined. Some compilers issue a warning when an incomplete type is deleted, but unfortunately, not all do, and programmers sometimes ignore or disable warnings.
In other words, if you use a lot of forward declarations you should prefer to use boost::checked_delete.
Note that std::auto_ptr does NOT use a checked delete! When you really need a checked delete, use boost::scoped_ptr instead (but note that boost::scoped_ptr has a slightly different interface then std::auto_ptr).
Links
- Boost's checked_delete documention:
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
