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