source: NonGTP/Boost/boost/python/detail/enable_if.hpp @ 857

Revision 857, 1.8 KB checked in by igarcia, 19 years ago (diff)
RevLine 
[857]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
13namespace boost { namespace python { namespace detail {
14
15template <class T> struct always_void { typedef void type; };
16
17template <class C, class T = int>
18struct enable_if_arg
19{
20    typedef typename mpl::if_<C,T,int&>::type type;
21};
22             
23template <class C, class T = int>
24struct disable_if_arg
25{
26    typedef typename mpl::if_<C,int&,T>::type type;
27};
28             
29template <class C, class T = typename always_void<C>::type>
30struct enable_if_ret
31{
32    typedef typename mpl::if_<C,T,int[2]>::type type;
33};
34             
35template <class C, class T = typename always_void<C>::type>
36struct 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
46namespace boost { namespace python { namespace detail {
47
48template <class C, class T = int>
49struct enable_if_arg
50  : enable_if<C,T>
51{};
52             
53template <class C, class T = int>
54struct disable_if_arg
55  : disable_if<C,T>
56{};
57             
58template <class C, class T = void>
59struct enable_if_ret
60  : enable_if<C,T>
61{};
62             
63template <class C, class T = void>
64struct 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
Note: See TracBrowser for help on using the repository browser.