]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/phoenix/include/boost/phoenix/statement/detail/switch.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / phoenix / include / boost / phoenix / statement / detail / switch.hpp
1
2 #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
3 #ifndef BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
4 #define BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
5
6 #include <boost/phoenix/support/iterate.hpp>
7
8 #include <boost/phoenix/statement/detail/preprocessed/switch.hpp>
9
10 #endif
11 #else
12
13 #if !BOOST_PHOENIX_IS_ITERATING
14
15 #ifndef BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
16 #define BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
17
18 #include <boost/phoenix/support/iterate.hpp>
19
20 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
21 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/switch_" BOOST_PHOENIX_LIMIT_STR ".hpp")
22 #endif
23
24 /*==============================================================================
25 Copyright (c) 2005-2010 Joel de Guzman
26 Copyright (c) 2010 Thomas Heller
27
28 Distributed under the Boost Software License, Version 1.0. (See accompanying
29 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
30 ==============================================================================*/
31
32 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
33 #pragma wave option(preserve: 1)
34 #endif
35
36 #define BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF_R(Z, N, DATA) \
37 typedef \
38 typename fusion::result_of::deref< \
39 typename fusion::result_of::advance_c< \
40 flat_view_begin \
41 , N \
42 >::type \
43 >::type \
44 BOOST_PP_CAT(case, N); \
45 typedef \
46 typename proto::detail::uncvref< \
47 typename proto::result_of::value< \
48 typename proto::result_of::child_c< \
49 BOOST_PP_CAT(case, N) \
50 , 0 \
51 >::type \
52 >::type \
53 >::type \
54 BOOST_PP_CAT(case_label, N); \
55 /**/
56
57 #define BOOST_PHOENIX_SWITCH_EVAL_R(Z, N, DATA) \
58 case BOOST_PP_CAT(case_label, N)::value : \
59 boost::phoenix::eval( \
60 proto::child_c<1>( \
61 fusion::deref( \
62 fusion::advance_c<N>(fusion::begin(flat_view)) \
63 ) \
64 ) \
65 , ctx \
66 ); \
67 break; \
68 /**/
69
70 #define BOOST_PHOENIX_ITERATION_PARAMS \
71 (3, (2, BOOST_PHOENIX_LIMIT, \
72 <boost/phoenix/statement/detail/switch.hpp>))
73 #include BOOST_PHOENIX_ITERATE()
74
75 #undef BOOST_PHOENIX_SWITCH_EVAL_R
76 #undef BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF
77
78 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
79 #pragma wave option(output: null)
80 #endif
81
82 #endif
83
84 #else
85 template <typename Context, typename Cond, typename Cases>
86 result_type
87 evaluate(
88 Context const & ctx
89 , Cond const & cond
90 , Cases const & cases
91 , mpl::int_<BOOST_PHOENIX_ITERATION>
92 , mpl::false_
93 ) const
94 {
95 typedef
96 typename proto::result_of::flatten<Cases const&>::type
97 flat_view_type;
98
99 typedef
100 typename fusion::result_of::begin<flat_view_type>::type
101 flat_view_begin;
102
103 flat_view_type flat_view(proto::flatten(cases));
104
105 BOOST_PP_REPEAT(
106 BOOST_PHOENIX_ITERATION
107 , BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF_R
108 , BOOST_PHOENIX_ITERATION
109 )
110
111 switch(boost::phoenix::eval(cond, ctx))
112 {
113 BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_SWITCH_EVAL_R, _)
114 }
115 }
116
117 template <typename Context, typename Cond, typename Cases>
118 result_type
119 evaluate(
120 Context const & ctx
121 , Cond const & cond
122 , Cases const & cases
123 , mpl::int_<BOOST_PHOENIX_ITERATION>
124 , mpl::true_
125 ) const
126 {
127 typedef
128 typename proto::result_of::flatten<Cases const&>::type
129 flat_view_type;
130
131 typedef
132 typename fusion::result_of::begin<flat_view_type>::type
133 flat_view_begin;
134
135 flat_view_type flat_view(proto::flatten(cases));
136
137 BOOST_PP_REPEAT(
138 BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)
139 , BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF_R
140 , BOOST_PHOENIX_ITERATION
141 )
142
143 switch(boost::phoenix::eval(cond, ctx))
144 {
145 BOOST_PP_REPEAT(
146 BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)
147 , BOOST_PHOENIX_SWITCH_EVAL_R, _
148 )
149 default:
150 boost::phoenix::eval(
151 proto::child_c<0>(
152 fusion::deref(
153 fusion::advance_c<
154 BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)
155 >(fusion::begin(flat_view))
156 )
157 )
158 , ctx
159 );
160 }
161 }
162
163 #endif
164
165 #endif // BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES