Update contrib.
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 # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
11 # include <boost/type_traits/is_enum.hpp>
13 namespace boost { namespace python { namespace detail {
17 # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
18 , bool enum_ // vc7 has a problem destroying enums
20 > struct value_destroyer;
23 struct value_destroyer<
25 # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
31 static void execute(T const volatile* p)
38 struct value_destroyer<
40 # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
45 template <class A, class T>
46 static void execute(A*, T const volatile* const first)
48 for (T const volatile* p = first; p != first + sizeof(A)/sizeof(T); ++p)
51 boost::is_array<T>::value
52 # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
53 , boost::is_enum<T>::value
60 static void execute(T const volatile* p)
66 # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
68 struct value_destroyer<true,true>
71 static void execute(T const volatile*)
77 struct value_destroyer<false,true>
80 static void execute(T const volatile*)
86 inline void destroy_referent_impl(void* p, T& (*)())
88 // note: cv-qualification needed for MSVC6
89 // must come *before* T for metrowerks
91 (boost::is_array<T>::value)
92 # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
93 , (boost::is_enum<T>::value)
95 >::execute((const volatile T*)p);
99 inline void destroy_referent(void* p, T(*)() = 0)
101 destroy_referent_impl(p, (T(*)())0);
104 }}} // namespace boost::python::detail
106 #endif // DESTROY_DWA2002221_HPP