77# define DESTROY_DWA2002221_HPP
88
99# include < boost/type_traits/is_array.hpp>
10-
10+ # include < boost/detail/workaround.hpp>
11+ # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
12+ # include < boost/type_traits/is_enum.hpp>
13+ # endif
1114namespace boost { namespace python { namespace detail {
1215
13- template <bool array> struct value_destroyer ;
16+ template <
17+ bool array
18+ # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
19+ , bool enum_ // vc7 has a problem destroying enums
20+ # endif
21+ > struct value_destroyer ;
1422
1523template <>
16- struct value_destroyer <false >
24+ struct value_destroyer <
25+ false
26+ # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
27+ , false
28+ # endif
29+ >
1730{
1831 template <class T >
1932 static void execute (T const volatile * p)
@@ -23,7 +36,12 @@ struct value_destroyer<false>
2336};
2437
2538template <>
26- struct value_destroyer <true >
39+ struct value_destroyer <
40+ true
41+ # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
42+ , false
43+ # endif
44+ >
2745{
2846 template <class A , class T >
2947 static void execute (A*, T const volatile * const first)
@@ -32,6 +50,9 @@ struct value_destroyer<true>
3250 {
3351 value_destroyer<
3452 boost::is_array<T>::value
53+ # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
54+ , boost::is_enum<T>::value
55+ # endif
3556 >::execute (p);
3657 }
3758 }
@@ -43,13 +64,35 @@ struct value_destroyer<true>
4364 }
4465};
4566
67+ # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
68+ template <>
69+ struct value_destroyer <true ,true >
70+ {
71+ template <class T >
72+ static void execute (T const volatile *)
73+ {
74+ }
75+ };
76+
77+ template <>
78+ struct value_destroyer <false ,true >
79+ {
80+ template <class T >
81+ static void execute (T const volatile *)
82+ {
83+ }
84+ };
85+ # endif
4686template <class T >
4787inline void destroy_referent_impl (void * p, T& (*)())
4888{
4989 // note: cv-qualification needed for MSVC6
5090 // must come *before* T for metrowerks
5191 value_destroyer<
5292 (boost::is_array<T>::value)
93+ # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
94+ , (boost::is_enum<T>::value)
95+ # endif
5396 >::execute ((const volatile T*)p);
5497}
5598
0 commit comments