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 template <class T>
29 struct elif_selected
30 {
31 # if !(defined(__MWERKS__) && __MWERKS__ <= 0x2407)
32     template <class U> class then;
33 # else
34     template <class U>
35     struct then : if_selected<T>
36     {
37     };
38 # endif
39 };
40 
41 # if !(defined(__MWERKS__) && __MWERKS__ <= 0x2407)
42 template <class T>
43 template <class U>
44 class elif_selected<T>::then : public if_selected<T>
45 {
46 };
47 # endif
48 
49 template <bool b> struct if_
50 {
51     template <class T>
52     struct then : if_selected<T>
53     {
54     };
55 };
56 
57 struct if_unselected
58 {
59     template <bool b> struct elif : if_<b>
60     {
61     };
62 
63     template <class U>
64     struct else_
65     {
66         typedef U type;
67     };
68 };
69 
70 template <>
71 struct if_<false>
72 {
73     template <class T>
74     struct then : if_unselected
75     {
76     };
77 };
78 
79 }}} // namespace boost::python::detail
80 
81 #endif // IF_ELSE_DWA2002322_HPP
82