Chris@16
|
1 // Copyright David Abrahams 2002.
|
Chris@16
|
2 // Distributed under the Boost Software License, Version 1.0. (See
|
Chris@16
|
3 // accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
4 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
5 #ifndef IF_ELSE_DWA2002322_HPP
|
Chris@16
|
6 # define IF_ELSE_DWA2002322_HPP
|
Chris@16
|
7 # include <boost/config.hpp>
|
Chris@16
|
8
|
Chris@16
|
9 namespace boost { namespace python { namespace detail {
|
Chris@16
|
10
|
Chris@16
|
11 template <class T> struct elif_selected;
|
Chris@16
|
12
|
Chris@16
|
13 template <class T>
|
Chris@16
|
14 struct if_selected
|
Chris@16
|
15 {
|
Chris@16
|
16 template <bool b>
|
Chris@16
|
17 struct elif : elif_selected<T>
|
Chris@16
|
18 {
|
Chris@16
|
19 };
|
Chris@16
|
20
|
Chris@16
|
21 template <class U>
|
Chris@16
|
22 struct else_
|
Chris@16
|
23 {
|
Chris@16
|
24 typedef T type;
|
Chris@16
|
25 };
|
Chris@16
|
26 };
|
Chris@16
|
27
|
Chris@16
|
28 # if defined(BOOST_MSVC) && (BOOST_MSVC == 1300)
|
Chris@16
|
29 namespace msvc70_aux {
|
Chris@16
|
30
|
Chris@16
|
31 template< bool > struct inherit_from
|
Chris@16
|
32 {
|
Chris@16
|
33 template< typename T > struct result
|
Chris@16
|
34 {
|
Chris@16
|
35 typedef T type;
|
Chris@16
|
36 };
|
Chris@16
|
37 };
|
Chris@16
|
38
|
Chris@16
|
39 template<> struct inherit_from<true>
|
Chris@16
|
40 {
|
Chris@16
|
41 template< typename T > struct result
|
Chris@16
|
42 {
|
Chris@16
|
43 struct type {};
|
Chris@16
|
44 };
|
Chris@16
|
45 };
|
Chris@16
|
46
|
Chris@16
|
47 template< typename T >
|
Chris@16
|
48 struct never_true
|
Chris@16
|
49 {
|
Chris@16
|
50 BOOST_STATIC_CONSTANT(bool, value = false);
|
Chris@16
|
51 };
|
Chris@16
|
52
|
Chris@16
|
53 } // namespace msvc70_aux
|
Chris@16
|
54
|
Chris@16
|
55 #endif // # if defined(BOOST_MSVC) && (BOOST_MSVC == 1300)
|
Chris@16
|
56
|
Chris@16
|
57 template <class T>
|
Chris@16
|
58 struct elif_selected
|
Chris@16
|
59 {
|
Chris@16
|
60 # if !(defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__MWERKS__) && __MWERKS__ <= 0x2407)
|
Chris@16
|
61 template <class U> class then;
|
Chris@16
|
62 # elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300)
|
Chris@16
|
63 template <class U>
|
Chris@16
|
64 struct then : msvc70_aux::inherit_from< msvc70_aux::never_true<U>::value >
|
Chris@16
|
65 ::template result< if_selected<T> >::type
|
Chris@16
|
66 {
|
Chris@16
|
67 };
|
Chris@16
|
68 # else
|
Chris@16
|
69 template <class U>
|
Chris@16
|
70 struct then : if_selected<T>
|
Chris@16
|
71 {
|
Chris@16
|
72 };
|
Chris@16
|
73 # endif
|
Chris@16
|
74 };
|
Chris@16
|
75
|
Chris@16
|
76 # if !(defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__MWERKS__) && __MWERKS__ <= 0x2407)
|
Chris@16
|
77 template <class T>
|
Chris@16
|
78 template <class U>
|
Chris@16
|
79 class elif_selected<T>::then : public if_selected<T>
|
Chris@16
|
80 {
|
Chris@16
|
81 };
|
Chris@16
|
82 # endif
|
Chris@16
|
83
|
Chris@16
|
84 template <bool b> struct if_
|
Chris@16
|
85 {
|
Chris@16
|
86 template <class T>
|
Chris@16
|
87 struct then : if_selected<T>
|
Chris@16
|
88 {
|
Chris@16
|
89 };
|
Chris@16
|
90 };
|
Chris@16
|
91
|
Chris@16
|
92 struct if_unselected
|
Chris@16
|
93 {
|
Chris@16
|
94 template <bool b> struct elif : if_<b>
|
Chris@16
|
95 {
|
Chris@16
|
96 };
|
Chris@16
|
97
|
Chris@16
|
98 template <class U>
|
Chris@16
|
99 struct else_
|
Chris@16
|
100 {
|
Chris@16
|
101 typedef U type;
|
Chris@16
|
102 };
|
Chris@16
|
103 };
|
Chris@16
|
104
|
Chris@16
|
105 template <>
|
Chris@16
|
106 struct if_<false>
|
Chris@16
|
107 {
|
Chris@16
|
108 template <class T>
|
Chris@16
|
109 struct then : if_unselected
|
Chris@16
|
110 {
|
Chris@16
|
111 };
|
Chris@16
|
112 };
|
Chris@16
|
113
|
Chris@16
|
114 }}} // namespace boost::python::detail
|
Chris@16
|
115
|
Chris@16
|
116 #endif // IF_ELSE_DWA2002322_HPP
|