|
14 | 14 | # include <boost/type_traits/is_reference.hpp> |
15 | 15 | # include <boost/type_traits/add_reference.hpp> |
16 | 16 |
|
17 | | -# define BOOST_PYTHON_IS_XXX_DEF(name, qualified_name, nargs) \ |
18 | | -template <class X_> \ |
19 | | -struct is_##name \ |
20 | | -{ \ |
21 | | - typedef char yes; \ |
22 | | - typedef char (&no)[2]; \ |
23 | | - \ |
24 | | - static typename add_reference<X_>::type dummy; \ |
25 | | - \ |
26 | | - template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class U) > \ |
27 | | - static yes test( \ |
28 | | - qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, U) >&, int \ |
29 | | - ); \ |
30 | | - \ |
31 | | - template <class U> \ |
32 | | - static no test(U&, ...); \ |
33 | | - \ |
34 | | - BOOST_STATIC_CONSTANT( \ |
35 | | - bool, value \ |
36 | | - = !is_reference<X_>::value \ |
37 | | - & (sizeof(test(dummy, 0)) == sizeof(yes))); \ |
38 | | - \ |
39 | | - typedef mpl::bool_<value> type; \ |
| 17 | +# define BOOST_PYTHON_IS_XXX_DEF(name, qualified_name, nargs) \ |
| 18 | +template <class X_> \ |
| 19 | +struct is_##name \ |
| 20 | +{ \ |
| 21 | + typedef char yes; \ |
| 22 | + typedef char (&no)[2]; \ |
| 23 | + \ |
| 24 | + static typename add_reference<X_>::type dummy; \ |
| 25 | + \ |
| 26 | + struct helpers \ |
| 27 | + { \ |
| 28 | + template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class U) > \ |
| 29 | + static yes test( \ |
| 30 | + qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, U) >&, int \ |
| 31 | + ); \ |
| 32 | + \ |
| 33 | + template <class U> \ |
| 34 | + static no test(U&, ...); \ |
| 35 | + }; \ |
| 36 | + \ |
| 37 | + BOOST_STATIC_CONSTANT( \ |
| 38 | + bool, value \ |
| 39 | + = !is_reference<X_>::value \ |
| 40 | + & (sizeof(helpers::test(dummy, 0)) == sizeof(yes))); \ |
| 41 | + \ |
| 42 | + typedef mpl::bool_<value> type; \ |
40 | 43 | }; |
41 | 44 |
|
42 | 45 | # else |
43 | 46 |
|
44 | 47 | # define BOOST_PYTHON_IS_XXX_DEF(name, qualified_name, nargs) \ |
45 | 48 | template <class T> \ |
46 | | -struct is_##name : mpl::false_ \ |
| 49 | +struct is_##name : mpl::false_ \ |
47 | 50 | { \ |
48 | 51 | }; \ |
49 | 52 | \ |
50 | 53 | template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class T) > \ |
51 | 54 | struct is_##name< \ |
52 | 55 | qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, T) > \ |
53 | 56 | > \ |
54 | | - : mpl::true_ \ |
| 57 | + : mpl::true_ \ |
55 | 58 | { \ |
56 | 59 | }; |
57 | 60 |
|
|
0 commit comments