1 // Copyright David Abrahams 2002.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef DESTROY_DWA2002221_HPP
6 # define DESTROY_DWA2002221_HPP
8 # include <boost/type_traits/is_array.hpp>
9 # include <boost/detail/workaround.hpp>
10 namespace boost { namespace python { namespace detail {
12 template <bool array> struct value_destroyer;
15 struct value_destroyer<false>
18 static void execute(T const volatile* p)
25 struct value_destroyer<true>
27 template <class A, class T>
28 static void execute(A*, T const volatile* const first)
30 for (T const volatile* p = first; p != first + sizeof(A)/sizeof(T); ++p)
33 boost::is_array<T>::value
39 static void execute(T const volatile* p)
46 inline void destroy_referent_impl(void* p, T& (*)())
48 // note: cv-qualification needed for MSVC6
49 // must come *before* T for metrowerks
51 (boost::is_array<T>::value)
52 >::execute((const volatile T*)p);
56 inline void destroy_referent(void* p, T(*)() = 0)
58 destroy_referent_impl(p, (T(*)())0);
61 }}} // namespace boost::python::detail
63 #endif // DESTROY_DWA2002221_HPP