123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #ifndef BOOST_CHECKED_DELETE_HPP_INCLUDED
- #define BOOST_CHECKED_DELETE_HPP_INCLUDED
- #if defined(_MSC_VER) && (_MSC_VER >= 1020)
- # pragma once
- #endif
- namespace boost
- {
- template<class T> inline void checked_delete(T * x)
- {
-
- typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
- (void) sizeof(type_must_be_complete);
- delete x;
- }
- template<class T> inline void checked_array_delete(T * x)
- {
- typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
- (void) sizeof(type_must_be_complete);
- delete [] x;
- }
- template<class T> struct checked_deleter
- {
- typedef void result_type;
- typedef T * argument_type;
- void operator()(T * x) const
- {
-
- boost::checked_delete(x);
- }
- };
- template<class T> struct checked_array_deleter
- {
- typedef void result_type;
- typedef T * argument_type;
- void operator()(T * x) const
- {
- boost::checked_array_delete(x);
- }
- };
- }
- #endif
|