File indexing completed on 2025-01-18 09:50:38
0001
0002
0003
0004
0005 #ifndef DESTROY_DWA2002221_HPP
0006 # define DESTROY_DWA2002221_HPP
0007
0008 # include <boost/python/detail/type_traits.hpp>
0009 # include <boost/detail/workaround.hpp>
0010 namespace boost { namespace python { namespace detail {
0011
0012 template <bool array> struct value_destroyer;
0013
0014 template <>
0015 struct value_destroyer<false>
0016 {
0017 template <class T>
0018 static void execute(T const volatile* p)
0019 {
0020 p->~T();
0021 }
0022 };
0023
0024 template <>
0025 struct value_destroyer<true>
0026 {
0027 template <class A, class T>
0028 static void execute(A*, T const volatile* const first)
0029 {
0030 for (T const volatile* p = first; p != first + sizeof(A)/sizeof(T); ++p)
0031 {
0032 value_destroyer<
0033 is_array<T>::value
0034 >::execute(p);
0035 }
0036 }
0037
0038 template <class T>
0039 static void execute(T const volatile* p)
0040 {
0041 execute(p, *p);
0042 }
0043 };
0044
0045 template <class T>
0046 inline void destroy_referent_impl(void* p, T& (*)())
0047 {
0048
0049
0050 value_destroyer<
0051 (is_array<T>::value)
0052 >::execute((const volatile T*)p);
0053 }
0054
0055 template <class T>
0056 inline void destroy_referent(void* p, T(*)() = 0)
0057 {
0058 destroy_referent_impl(p, (T(*)())0);
0059 }
0060
0061 }}}
0062
0063 #endif