| 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 (BOOST_PARAMETER_MAX_ARITY < 16) |
| 9 | #error Define BOOST_PARAMETER_MAX_ARITY as 16 or greater. |
| 10 | #endif |
| 11 | |
| 12 | #include <boost/parameter/name.hpp> |
| 13 | |
| 14 | namespace test { |
| 15 | |
| 16 | BOOST_PARAMETER_NAME((_lrc0, keywords) in(lrc0)) |
| 17 | BOOST_PARAMETER_NAME((_lr1, keywords) out(lr1)) |
| 18 | BOOST_PARAMETER_NAME((_lr2, keywords) out(lr2)) |
| 19 | BOOST_PARAMETER_NAME((_lrc3, keywords) in(lrc3)) |
| 20 | BOOST_PARAMETER_NAME((_lrc4, keywords) in(lrc4)) |
| 21 | BOOST_PARAMETER_NAME((_lr5, keywords) out(lr5)) |
| 22 | BOOST_PARAMETER_NAME((_lr6, keywords) out(lr6)) |
| 23 | BOOST_PARAMETER_NAME((_lrc7, keywords) in(lrc7)) |
| 24 | BOOST_PARAMETER_NAME((_rrc0, keywords) in(rrc0)) |
| 25 | BOOST_PARAMETER_NAME((_rrc1, keywords) in(rrc1)) |
| 26 | BOOST_PARAMETER_NAME((_rrc2, keywords) in(rrc2)) |
| 27 | BOOST_PARAMETER_NAME((_rrc3, keywords) in(rrc3)) |
| 28 | BOOST_PARAMETER_NAME((_rrc4, keywords) in(rrc4)) |
| 29 | BOOST_PARAMETER_NAME((_rrc5, keywords) in(rrc5)) |
| 30 | BOOST_PARAMETER_NAME((_rrc6, keywords) in(rrc6)) |
| 31 | BOOST_PARAMETER_NAME((_rrc7, keywords) in(rrc7)) |
| 32 | } // namespace test |
| 33 | |
| 34 | #include <boost/parameter/parameters.hpp> |
| 35 | #include <boost/parameter/required.hpp> |
| 36 | #include <boost/parameter/optional.hpp> |
| 37 | |
| 38 | namespace test { |
| 39 | |
| 40 | struct h_parameters |
| 41 | : boost::parameter::parameters< |
| 42 | boost::parameter::required<test::keywords::lrc0> |
| 43 | , boost::parameter::required<test::keywords::rrc0> |
| 44 | , boost::parameter::required<test::keywords::lr1> |
| 45 | , boost::parameter::required<test::keywords::rrc1> |
| 46 | , boost::parameter::required<test::keywords::lr2> |
| 47 | , boost::parameter::required<test::keywords::rrc2> |
| 48 | , boost::parameter::required<test::keywords::lrc3> |
| 49 | , boost::parameter::required<test::keywords::rrc3> |
| 50 | , boost::parameter::optional<test::keywords::lrc4> |
| 51 | , boost::parameter::optional<test::keywords::rrc4> |
| 52 | , boost::parameter::optional<test::keywords::lr5> |
| 53 | , boost::parameter::optional<test::keywords::rrc5> |
| 54 | , boost::parameter::optional<test::keywords::lr6> |
| 55 | , boost::parameter::optional<test::keywords::rrc6> |
| 56 | , boost::parameter::optional<test::keywords::lrc7> |
| 57 | , boost::parameter::optional<test::keywords::rrc7> |
| 58 | > |
| 59 | { |
| 60 | }; |
| 61 | } // namespace test |
| 62 | |
| 63 | #include <boost/core/lightweight_test.hpp> |
| 64 | #include "evaluate_category.hpp" |
| 65 | |
| 66 | namespace test { |
| 67 | |
| 68 | struct D |
| 69 | { |
| 70 | template <typename Args> |
| 71 | static void evaluate(Args const& args) |
| 72 | { |
| 73 | BOOST_TEST_EQ( |
| 74 | test::passed_by_lvalue_reference_to_const |
| 75 | , test::U::evaluate_category<0>(args[test::_lrc0]) |
| 76 | ); |
| 77 | BOOST_TEST_EQ( |
| 78 | test::passed_by_lvalue_reference |
| 79 | , test::U::evaluate_category<1>(args[test::_lr1]) |
| 80 | ); |
| 81 | BOOST_TEST_EQ( |
| 82 | test::passed_by_lvalue_reference |
| 83 | , test::U::evaluate_category<2>(args[test::_lr2]) |
| 84 | ); |
| 85 | BOOST_TEST_EQ( |
| 86 | test::passed_by_lvalue_reference_to_const |
| 87 | , test::U::evaluate_category<3>(args[test::_lrc3]) |
| 88 | ); |
| 89 | BOOST_TEST_EQ( |
| 90 | test::passed_by_lvalue_reference_to_const |
| 91 | , test::U::evaluate_category<4>( |
| 92 | args[test::_lrc4 | test::lvalue_const_bitset<4>()] |
| 93 | ) |
| 94 | ); |
| 95 | BOOST_TEST_EQ( |
| 96 | test::passed_by_lvalue_reference |
| 97 | , test::U::evaluate_category<5>( |
| 98 | args[ |
| 99 | test::_lr5 || test::lvalue_bitset_function<5>() |
| 100 | ] |
| 101 | ) |
| 102 | ); |
| 103 | BOOST_TEST_EQ( |
| 104 | test::passed_by_lvalue_reference |
| 105 | , test::U::evaluate_category<6>( |
| 106 | args[test::_lr6 | test::lvalue_bitset<6>()] |
| 107 | ) |
| 108 | ); |
| 109 | BOOST_TEST_EQ( |
| 110 | test::passed_by_lvalue_reference_to_const |
| 111 | , test::U::evaluate_category<7>( |
| 112 | args[ |
| 113 | test::_lrc7 || test::lvalue_const_bitset_function<7>() |
| 114 | ] |
| 115 | ) |
| 116 | ); |
| 117 | #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) |
| 118 | BOOST_TEST_EQ( |
| 119 | test::passed_by_rvalue_reference_to_const |
| 120 | , test::U::evaluate_category<0>(args[test::_rrc0]) |
| 121 | ); |
| 122 | BOOST_TEST_EQ( |
| 123 | test::passed_by_rvalue_reference_to_const |
| 124 | , test::U::evaluate_category<1>(args[test::_rrc1]) |
| 125 | ); |
| 126 | BOOST_TEST_EQ( |
| 127 | test::passed_by_rvalue_reference_to_const |
| 128 | , test::U::evaluate_category<2>(args[test::_rrc2]) |
| 129 | ); |
| 130 | BOOST_TEST_EQ( |
| 131 | test::passed_by_rvalue_reference_to_const |
| 132 | , test::U::evaluate_category<3>(args[test::_rrc3]) |
| 133 | ); |
| 134 | BOOST_TEST_EQ( |
| 135 | test::passed_by_rvalue_reference_to_const |
| 136 | , test::U::evaluate_category<4>( |
| 137 | args[test::_rrc4 | test::rvalue_const_bitset<4>()] |
| 138 | ) |
| 139 | ); |
| 140 | BOOST_TEST_EQ( |
| 141 | test::passed_by_rvalue_reference_to_const |
| 142 | , test::U::evaluate_category<5>( |
| 143 | args[ |
| 144 | test::_rrc5 || test::rvalue_const_bitset_function<5>() |
| 145 | ] |
| 146 | ) |
| 147 | ); |
| 148 | BOOST_TEST_EQ( |
| 149 | test::passed_by_rvalue_reference_to_const |
| 150 | , test::U::evaluate_category<6>( |
| 151 | args[test::_rrc6 | test::rvalue_const_bitset<6>()] |
| 152 | ) |
| 153 | ); |
| 154 | BOOST_TEST_EQ( |
| 155 | test::passed_by_rvalue_reference_to_const |
| 156 | , test::U::evaluate_category<7>( |
| 157 | args[ |
| 158 | test::_rrc7 || test::rvalue_const_bitset_function<7>() |
| 159 | ] |
| 160 | ) |
| 161 | ); |
| 162 | #else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) |
| 163 | BOOST_TEST_EQ( |
| 164 | test::passed_by_lvalue_reference_to_const |
| 165 | , test::U::evaluate_category<0>(args[test::_rrc0]) |
| 166 | ); |
| 167 | BOOST_TEST_EQ( |
| 168 | test::passed_by_lvalue_reference_to_const |
| 169 | , test::U::evaluate_category<1>(args[test::_rrc1]) |
| 170 | ); |
| 171 | BOOST_TEST_EQ( |
| 172 | test::passed_by_lvalue_reference_to_const |
| 173 | , test::U::evaluate_category<2>(args[test::_rrc2]) |
| 174 | ); |
| 175 | BOOST_TEST_EQ( |
| 176 | test::passed_by_lvalue_reference_to_const |
| 177 | , test::U::evaluate_category<3>(args[test::_rrc3]) |
| 178 | ); |
| 179 | BOOST_TEST_EQ( |
| 180 | test::passed_by_lvalue_reference_to_const |
| 181 | , test::U::evaluate_category<4>( |
| 182 | args[test::_rrc4 | test::rvalue_const_bitset<4>()] |
| 183 | ) |
| 184 | ); |
| 185 | BOOST_TEST_EQ( |
| 186 | test::passed_by_lvalue_reference_to_const |
| 187 | , test::U::evaluate_category<5>( |
| 188 | args[ |
| 189 | test::_rrc5 || test::rvalue_const_bitset_function<5>() |
| 190 | ] |
| 191 | ) |
| 192 | ); |
| 193 | BOOST_TEST_EQ( |
| 194 | test::passed_by_lvalue_reference_to_const |
| 195 | , test::U::evaluate_category<6>( |
| 196 | args[test::_rrc6 | test::rvalue_const_bitset<6>()] |
| 197 | ) |
| 198 | ); |
| 199 | BOOST_TEST_EQ( |
| 200 | test::passed_by_lvalue_reference_to_const |
| 201 | , test::U::evaluate_category<7>( |
| 202 | args[ |
| 203 | test::_rrc7 || test::rvalue_const_bitset_function<7>() |
| 204 | ] |
| 205 | ) |
| 206 | ); |
| 207 | #endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING |
| 208 | } |
| 209 | }; |
| 210 | } // namespace test |
| 211 | |
| 212 | int main() |
| 213 | { |
| 214 | test::D::evaluate( |
| 215 | args: test::h_parameters()( |
| 216 | test::lvalue_const_bitset<0>() |
| 217 | , test::rvalue_const_bitset<0>() |
| 218 | , test::lvalue_bitset<1>() |
| 219 | , test::rvalue_const_bitset<1>() |
| 220 | , test::lvalue_bitset<2>() |
| 221 | , test::rvalue_const_bitset<2>() |
| 222 | , test::lvalue_const_bitset<3>() |
| 223 | , test::rvalue_const_bitset<3>() |
| 224 | ) |
| 225 | ); |
| 226 | test::D::evaluate( |
| 227 | args: test::h_parameters()( |
| 228 | test::lvalue_const_bitset<0>() |
| 229 | , test::rvalue_const_bitset<0>() |
| 230 | , test::lvalue_bitset<1>() |
| 231 | , test::rvalue_const_bitset<1>() |
| 232 | , test::lvalue_bitset<2>() |
| 233 | , test::rvalue_const_bitset<2>() |
| 234 | , test::lvalue_const_bitset<3>() |
| 235 | , test::rvalue_const_bitset<3>() |
| 236 | , test::lvalue_const_bitset<4>() |
| 237 | , test::rvalue_const_bitset<4>() |
| 238 | , test::lvalue_bitset<5>() |
| 239 | , test::rvalue_const_bitset<5>() |
| 240 | , test::lvalue_bitset<6>() |
| 241 | , test::rvalue_const_bitset<6>() |
| 242 | , test::lvalue_const_bitset<7>() |
| 243 | , test::rvalue_const_bitset<7>() |
| 244 | ) |
| 245 | ); |
| 246 | return boost::report_errors(); |
| 247 | } |
| 248 | |
| 249 | |