1 | // Copyright David Abrahams 2004. Distributed under the Boost |
---|
2 | // Software License, Version 1.0. (See accompanying |
---|
3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
---|
4 | #ifndef ENABLE_IF_DWA2004722_HPP |
---|
5 | # define ENABLE_IF_DWA2004722_HPP |
---|
6 | |
---|
7 | # include <boost/python/detail/sfinae.hpp> |
---|
8 | # include <boost/detail/workaround.hpp> |
---|
9 | |
---|
10 | # if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) |
---|
11 | # include <boost/mpl/if.hpp> |
---|
12 | |
---|
13 | namespace boost { namespace python { namespace detail { |
---|
14 | |
---|
15 | template <class T> struct always_void { typedef void type; }; |
---|
16 | |
---|
17 | template <class C, class T = int> |
---|
18 | struct enable_if_arg |
---|
19 | { |
---|
20 | typedef typename mpl::if_<C,T,int&>::type type; |
---|
21 | }; |
---|
22 | |
---|
23 | template <class C, class T = int> |
---|
24 | struct disable_if_arg |
---|
25 | { |
---|
26 | typedef typename mpl::if_<C,int&,T>::type type; |
---|
27 | }; |
---|
28 | |
---|
29 | template <class C, class T = typename always_void<C>::type> |
---|
30 | struct enable_if_ret |
---|
31 | { |
---|
32 | typedef typename mpl::if_<C,T,int[2]>::type type; |
---|
33 | }; |
---|
34 | |
---|
35 | template <class C, class T = typename always_void<C>::type> |
---|
36 | struct disable_if_ret |
---|
37 | { |
---|
38 | typedef typename mpl::if_<C,int[2],T>::type type; |
---|
39 | }; |
---|
40 | |
---|
41 | }}} // namespace boost::python::detail |
---|
42 | |
---|
43 | # elif !defined(BOOST_NO_SFINAE) |
---|
44 | # include <boost/utility/enable_if.hpp> |
---|
45 | |
---|
46 | namespace boost { namespace python { namespace detail { |
---|
47 | |
---|
48 | template <class C, class T = int> |
---|
49 | struct enable_if_arg |
---|
50 | : enable_if<C,T> |
---|
51 | {}; |
---|
52 | |
---|
53 | template <class C, class T = int> |
---|
54 | struct disable_if_arg |
---|
55 | : disable_if<C,T> |
---|
56 | {}; |
---|
57 | |
---|
58 | template <class C, class T = void> |
---|
59 | struct enable_if_ret |
---|
60 | : enable_if<C,T> |
---|
61 | {}; |
---|
62 | |
---|
63 | template <class C, class T = void> |
---|
64 | struct disable_if_ret |
---|
65 | : disable_if<C,T> |
---|
66 | {}; |
---|
67 | |
---|
68 | }}} // namespace boost::python::detail |
---|
69 | |
---|
70 | # endif |
---|
71 | |
---|
72 | #endif // ENABLE_IF_DWA2004722_HPP |
---|