| 1 | // Copyright Cromwell D. Enage 2017. |
| 2 | // Distributed under the Boost Software License, Version 1.0. |
| 3 | // (See accompanying file LICENSE_1_0.txt or copy at |
| 4 | // http://www.boost.org/LICENSE_1_0.txt) |
| 5 | |
| 6 | #include <boost/parameter/config.hpp> |
| 7 | |
| 8 | #if ( \ |
| 9 | defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \ |
| 10 | !defined(__MINGW32__) \ |
| 11 | ) || ( \ |
| 12 | !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \ |
| 13 | (10 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY) \ |
| 14 | ) |
| 15 | #if (BOOST_PARAMETER_MAX_ARITY < 10) |
| 16 | #error Define BOOST_PARAMETER_MAX_ARITY as 10 or greater. |
| 17 | #endif |
| 18 | #endif |
| 19 | |
| 20 | #include <boost/parameter/name.hpp> |
| 21 | |
| 22 | namespace test { |
| 23 | |
| 24 | BOOST_PARAMETER_NAME((_lrc0, keywords) in(lrc0)) |
| 25 | BOOST_PARAMETER_NAME((_lr0, keywords) in_out(lr0)) |
| 26 | BOOST_PARAMETER_NAME((_rrc0, keywords) in(rrc0)) |
| 27 | #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) |
| 28 | BOOST_PARAMETER_NAME((_rr0, keywords) consume(rr0)) |
| 29 | #else |
| 30 | BOOST_PARAMETER_NAME((_rr0, keywords) rr0) |
| 31 | #endif |
| 32 | BOOST_PARAMETER_NAME((_lrc1, keywords) in(lrc1)) |
| 33 | BOOST_PARAMETER_NAME((_lr1, keywords) out(lr1)) |
| 34 | BOOST_PARAMETER_NAME((_rrc1, keywords) in(rrc1)) |
| 35 | BOOST_PARAMETER_NAME((_lrc2, keywords) in(lrc2)) |
| 36 | BOOST_PARAMETER_NAME((_lr2, keywords) out(lr2)) |
| 37 | BOOST_PARAMETER_NAME((_rr2, keywords) rr2) |
| 38 | } // namespace test |
| 39 | |
| 40 | #if ( \ |
| 41 | defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \ |
| 42 | !defined(__MINGW32__) \ |
| 43 | ) || ( \ |
| 44 | !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \ |
| 45 | (10 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY) \ |
| 46 | ) |
| 47 | #include <boost/parameter/parameters.hpp> |
| 48 | #include <boost/parameter/required.hpp> |
| 49 | #include <boost/parameter/optional.hpp> |
| 50 | |
| 51 | namespace test { |
| 52 | |
| 53 | struct g_parameters |
| 54 | : boost::parameter::parameters< |
| 55 | boost::parameter::required<test::keywords::lrc0> |
| 56 | , boost::parameter::required<test::keywords::lr0> |
| 57 | , boost::parameter::required<test::keywords::rrc0> |
| 58 | , boost::parameter::required<test::keywords::rr0> |
| 59 | , boost::parameter::required<test::keywords::lrc1> |
| 60 | , boost::parameter::required<test::keywords::lr1> |
| 61 | , boost::parameter::required<test::keywords::rrc1> |
| 62 | , boost::parameter::optional<test::keywords::lrc2> |
| 63 | , boost::parameter::optional<test::keywords::lr2> |
| 64 | , boost::parameter::optional<test::keywords::rr2> |
| 65 | > |
| 66 | { |
| 67 | }; |
| 68 | } // namespace test |
| 69 | |
| 70 | #endif |
| 71 | |
| 72 | #include <boost/core/lightweight_test.hpp> |
| 73 | #include "evaluate_category.hpp" |
| 74 | |
| 75 | namespace test { |
| 76 | |
| 77 | struct C |
| 78 | { |
| 79 | template <typename Args> |
| 80 | static void evaluate(Args const& args) |
| 81 | { |
| 82 | BOOST_TEST_EQ( |
| 83 | test::passed_by_lvalue_reference_to_const |
| 84 | , test::U::evaluate_category<0>(args[test::_lrc0]) |
| 85 | ); |
| 86 | BOOST_TEST_EQ( |
| 87 | test::passed_by_lvalue_reference |
| 88 | , test::U::evaluate_category<0>(args[test::_lr0]) |
| 89 | ); |
| 90 | BOOST_TEST_EQ( |
| 91 | test::passed_by_lvalue_reference_to_const |
| 92 | , test::U::evaluate_category<1>(args[test::_lrc1]) |
| 93 | ); |
| 94 | BOOST_TEST_EQ( |
| 95 | test::passed_by_lvalue_reference |
| 96 | , test::U::evaluate_category<1>(args[test::_lr1]) |
| 97 | ); |
| 98 | BOOST_TEST_EQ( |
| 99 | test::passed_by_lvalue_reference_to_const |
| 100 | , test::U::evaluate_category<2>( |
| 101 | args[test::_lrc2 | test::lvalue_const_bitset<2>()] |
| 102 | ) |
| 103 | ); |
| 104 | BOOST_TEST_EQ( |
| 105 | test::passed_by_lvalue_reference |
| 106 | , test::U::evaluate_category<2>( |
| 107 | args[test::_lr2 || test::lvalue_bitset_function<2>()] |
| 108 | ) |
| 109 | ); |
| 110 | #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) |
| 111 | BOOST_TEST_EQ( |
| 112 | test::passed_by_rvalue_reference_to_const |
| 113 | , test::U::evaluate_category<0>(args[test::_rrc0]) |
| 114 | ); |
| 115 | BOOST_TEST_EQ( |
| 116 | test::passed_by_rvalue_reference |
| 117 | , test::U::evaluate_category<0>(args[test::_rr0]) |
| 118 | ); |
| 119 | BOOST_TEST_EQ( |
| 120 | test::passed_by_rvalue_reference_to_const |
| 121 | , test::U::evaluate_category<1>(args[test::_rrc1]) |
| 122 | ); |
| 123 | BOOST_TEST_EQ( |
| 124 | test::passed_by_rvalue_reference |
| 125 | , test::U::evaluate_category<2>( |
| 126 | args[test::_rr2 || test::rvalue_bitset_function<2>()] |
| 127 | ) |
| 128 | ); |
| 129 | #else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) |
| 130 | BOOST_TEST_EQ( |
| 131 | test::passed_by_lvalue_reference_to_const |
| 132 | , test::U::evaluate_category<0>(args[test::_rrc0]) |
| 133 | ); |
| 134 | BOOST_TEST_EQ( |
| 135 | test::passed_by_lvalue_reference_to_const |
| 136 | , test::U::evaluate_category<0>(args[test::_rr0]) |
| 137 | ); |
| 138 | BOOST_TEST_EQ( |
| 139 | test::passed_by_lvalue_reference_to_const |
| 140 | , test::U::evaluate_category<1>(args[test::_rrc1]) |
| 141 | ); |
| 142 | BOOST_TEST_EQ( |
| 143 | test::passed_by_lvalue_reference_to_const |
| 144 | , test::U::evaluate_category<2>( |
| 145 | args[test::_rr2 || test::rvalue_bitset_function<2>()] |
| 146 | ) |
| 147 | ); |
| 148 | #endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING |
| 149 | } |
| 150 | }; |
| 151 | } // namespace test |
| 152 | |
| 153 | #if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) |
| 154 | #include <boost/parameter/aux_/as_lvalue.hpp> |
| 155 | #endif |
| 156 | |
| 157 | int main() |
| 158 | { |
| 159 | #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) |
| 160 | #if defined(__MINGW32__) |
| 161 | test::C::evaluate(( |
| 162 | test::_rrc1 = test::rvalue_const_bitset<1>() |
| 163 | , test::_lrc0 = test::lvalue_const_bitset<0>() |
| 164 | , test::_lr0 = test::lvalue_bitset<0>() |
| 165 | , test::_rrc0 = test::rvalue_const_bitset<0>() |
| 166 | , test::_rr0 = test::rvalue_bitset<0>() |
| 167 | , test::_lrc1 = test::lvalue_const_bitset<1>() |
| 168 | , test::_lr1 = test::lvalue_bitset<1>() |
| 169 | )); |
| 170 | test::C::evaluate(( |
| 171 | test::_lr0 = test::lvalue_bitset<0>() |
| 172 | , test::_rrc0 = test::rvalue_const_bitset<0>() |
| 173 | , test::_rr0 = test::rvalue_bitset<0>() |
| 174 | , test::_lrc1 = test::lvalue_const_bitset<1>() |
| 175 | , test::_lr1 = test::lvalue_bitset<1>() |
| 176 | , test::_rrc1 = test::rvalue_const_bitset<1>() |
| 177 | , test::_lrc2 = test::lvalue_const_bitset<2>() |
| 178 | , test::_lr2 = test::lvalue_bitset<2>() |
| 179 | , test::_rr2 = test::rvalue_bitset<2>() |
| 180 | , test::_lrc0 = test::lvalue_const_bitset<0>() |
| 181 | )); |
| 182 | #else // !defined(__MINGW32__) |
| 183 | test::C::evaluate( |
| 184 | args: test::g_parameters()( |
| 185 | test::lvalue_const_bitset<0>() |
| 186 | , test::lvalue_bitset<0>() |
| 187 | , test::rvalue_const_bitset<0>() |
| 188 | , test::rvalue_bitset<0>() |
| 189 | , test::lvalue_const_bitset<1>() |
| 190 | , test::lvalue_bitset<1>() |
| 191 | , test::rvalue_const_bitset<1>() |
| 192 | ) |
| 193 | ); |
| 194 | test::C::evaluate( |
| 195 | args: test::g_parameters()( |
| 196 | test::lvalue_const_bitset<0>() |
| 197 | , test::lvalue_bitset<0>() |
| 198 | , test::rvalue_const_bitset<0>() |
| 199 | , test::rvalue_bitset<0>() |
| 200 | , test::lvalue_const_bitset<1>() |
| 201 | , test::lvalue_bitset<1>() |
| 202 | , test::rvalue_const_bitset<1>() |
| 203 | , test::lvalue_const_bitset<2>() |
| 204 | , test::lvalue_bitset<2>() |
| 205 | , test::rvalue_bitset<2>() |
| 206 | ) |
| 207 | ); |
| 208 | #endif // __MINGW32__ |
| 209 | #else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) |
| 210 | #if (10 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY) |
| 211 | test::C::evaluate( |
| 212 | test::g_parameters()( |
| 213 | test::lvalue_const_bitset<0>() |
| 214 | , test::lvalue_bitset<0>() |
| 215 | , test::rvalue_const_bitset<0>() |
| 216 | , boost::parameter::aux::as_lvalue(test::rvalue_bitset<0>()) |
| 217 | , test::lvalue_const_bitset<1>() |
| 218 | , test::lvalue_bitset<1>() |
| 219 | , test::rvalue_const_bitset<1>() |
| 220 | ) |
| 221 | ); |
| 222 | test::C::evaluate( |
| 223 | test::g_parameters()( |
| 224 | test::lvalue_const_bitset<0>() |
| 225 | , test::lvalue_bitset<0>() |
| 226 | , test::rvalue_const_bitset<0>() |
| 227 | , boost::parameter::aux::as_lvalue(test::rvalue_bitset<0>()) |
| 228 | , test::lvalue_const_bitset<1>() |
| 229 | , test::lvalue_bitset<1>() |
| 230 | , test::rvalue_const_bitset<1>() |
| 231 | , test::lvalue_const_bitset<2>() |
| 232 | , test::lvalue_bitset<2>() |
| 233 | , boost::parameter::aux::as_lvalue(test::rvalue_bitset<2>()) |
| 234 | ) |
| 235 | ); |
| 236 | #else // !(10 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY) |
| 237 | test::C::evaluate(( |
| 238 | test::_lrc0 = test::lvalue_const_bitset<0>() |
| 239 | , test::_lr0 = test::lvalue_bitset<0>() |
| 240 | , test::_rrc0 = test::rvalue_const_bitset<0>() |
| 241 | , test::_rr0 = boost::parameter::aux::as_lvalue( |
| 242 | test::rvalue_bitset<0>() |
| 243 | ) |
| 244 | , test::_lrc1 = test::lvalue_const_bitset<1>() |
| 245 | , test::_lr1 = test::lvalue_bitset<1>() |
| 246 | , test::_rrc1 = test::rvalue_const_bitset<1>() |
| 247 | )); |
| 248 | test::C::evaluate(( |
| 249 | test::_lrc0 = test::lvalue_const_bitset<0>() |
| 250 | , test::_lr0 = test::lvalue_bitset<0>() |
| 251 | , test::_rrc0 = test::rvalue_const_bitset<0>() |
| 252 | , test::_rr0 = boost::parameter::aux::as_lvalue( |
| 253 | test::rvalue_bitset<0>() |
| 254 | ) |
| 255 | , test::_lrc1 = test::lvalue_const_bitset<1>() |
| 256 | , test::_lr1 = test::lvalue_bitset<1>() |
| 257 | , test::_rrc1 = test::rvalue_const_bitset<1>() |
| 258 | , test::_lrc2 = test::lvalue_const_bitset<2>() |
| 259 | , test::_lr2 = test::lvalue_bitset<2>() |
| 260 | , test::_rr2 = boost::parameter::aux::as_lvalue( |
| 261 | test::rvalue_bitset<2>() |
| 262 | ) |
| 263 | )); |
| 264 | #endif // (10 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY) |
| 265 | #endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING |
| 266 | return boost::report_errors(); |
| 267 | } |
| 268 | |
| 269 | |