1 #ifndef BOOST_CHECKED_DELETE_HPP_INCLUDED
\r
2 #define BOOST_CHECKED_DELETE_HPP_INCLUDED
\r
4 // MS compatible compilers support #pragma once
\r
6 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
\r
11 // boost/checked_delete.hpp
\r
13 // Copyright (c) 2002, 2003 Peter Dimov
\r
14 // Copyright (c) 2003 Daniel Frey
\r
15 // Copyright (c) 2003 Howard Hinnant
\r
17 // Distributed under the Boost Software License, Version 1.0. (See
\r
18 // accompanying file LICENSE_1_0.txt or copy at
\r
19 // http://www.boost.org/LICENSE_1_0.txt)
\r
21 // See http://www.boost.org/libs/utility/checked_delete.html for documentation.
\r
27 // verify that types are complete for increased safety
\r
29 template<class T> inline void checked_delete(T * x)
\r
31 // intentionally complex - simplification causes regressions
\r
32 typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
\r
33 (void) sizeof(type_must_be_complete);
\r
37 template<class T> inline void checked_array_delete(T * x)
\r
39 typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
\r
40 (void) sizeof(type_must_be_complete);
\r
44 template<class T> struct checked_deleter
\r
46 typedef void result_type;
\r
47 typedef T * argument_type;
\r
49 void operator()(T * x) const
\r
51 // boost:: disables ADL
\r
52 boost::checked_delete(x);
\r
56 template<class T> struct checked_array_deleter
\r
58 typedef void result_type;
\r
59 typedef T * argument_type;
\r
61 void operator()(T * x) const
\r
63 boost::checked_array_delete(x);
\r
67 } // namespace boost
\r
69 #endif // #ifndef BOOST_CHECKED_DELETE_HPP_INCLUDED
\r