1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
// Copyright Cromwell D. Enage 2017.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/parameter/config.hpp>
#if (BOOST_PARAMETER_MAX_ARITY < 10)
#error Define BOOST_PARAMETER_MAX_ARITY as 10 or greater.
#endif
#include <boost/parameter.hpp>
namespace test {
BOOST_PARAMETER_NAME(in(lrc0))
BOOST_PARAMETER_NAME(out(lr0))
BOOST_PARAMETER_NAME(in(rrc0))
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
BOOST_PARAMETER_NAME(consume(rr0))
#else
BOOST_PARAMETER_NAME(rr0)
#endif
BOOST_PARAMETER_NAME(in(lrc1))
BOOST_PARAMETER_NAME(out(lr1))
BOOST_PARAMETER_NAME(in(rrc1))
BOOST_PARAMETER_NAME(in(lrc2))
BOOST_PARAMETER_NAME(out(lr2))
BOOST_PARAMETER_NAME(rr2)
struct g_parameters
: boost::parameter::parameters<
boost::parameter::required<test::tag::lrc0>
, boost::parameter::required<test::tag::lr0>
, boost::parameter::required<test::tag::rrc0>
, boost::parameter::required<test::tag::rr0>
, boost::parameter::required<test::tag::lrc1>
, boost::parameter::required<test::tag::lr1>
, boost::parameter::required<test::tag::rrc1>
, boost::parameter::optional<test::tag::lrc2>
, boost::parameter::optional<test::tag::lr2>
, boost::parameter::optional<test::tag::rr2>
>
{
};
} // namespace test
#include <boost/parameter/macros.hpp>
#include <boost/core/lightweight_test.hpp>
#include "evaluate_category.hpp"
namespace test {
struct C
{
BOOST_PARAMETER_MEMFUN(static int, evaluate, 7, 10, g_parameters)
{
BOOST_TEST_EQ(
test::passed_by_lvalue_reference_to_const
, U::evaluate_category<0>(p[test::_lrc0])
);
BOOST_TEST_EQ(
test::passed_by_lvalue_reference
, U::evaluate_category<0>(p[test::_lr0])
);
BOOST_TEST_EQ(
test::passed_by_lvalue_reference_to_const
, U::evaluate_category<1>(p[test::_lrc1])
);
BOOST_TEST_EQ(
test::passed_by_lvalue_reference
, U::evaluate_category<1>(p[test::_lr1])
);
BOOST_TEST_EQ(
test::passed_by_lvalue_reference_to_const
, U::evaluate_category<2>(
p[test::_lrc2 | test::lvalue_const_bitset<2>()]
)
);
BOOST_TEST_EQ(
test::passed_by_lvalue_reference
, U::evaluate_category<2>(
p[test::_lr2 || test::lvalue_bitset_function<2>()]
)
);
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
BOOST_TEST_EQ(
test::passed_by_rvalue_reference_to_const
, U::evaluate_category<0>(p[test::_rrc0])
);
BOOST_TEST_EQ(
test::passed_by_rvalue_reference
, U::evaluate_category<0>(p[test::_rr0])
);
BOOST_TEST_EQ(
test::passed_by_rvalue_reference_to_const
, U::evaluate_category<1>(p[test::_rrc1])
);
BOOST_TEST_EQ(
test::passed_by_rvalue_reference
, U::evaluate_category<2>(
p[test::_rr2 || test::rvalue_bitset_function<2>()]
)
);
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
BOOST_TEST_EQ(
test::passed_by_lvalue_reference_to_const
, U::evaluate_category<0>(p[test::_rrc0])
);
BOOST_TEST_EQ(
test::passed_by_lvalue_reference_to_const
, U::evaluate_category<0>(p[test::_rr0])
);
BOOST_TEST_EQ(
test::passed_by_lvalue_reference_to_const
, U::evaluate_category<1>(p[test::_rrc1])
);
BOOST_TEST_EQ(
test::passed_by_lvalue_reference_to_const
, U::evaluate_category<2>(
p[test::_rr2 || test::rvalue_bitset_function<2>()]
)
);
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
return 0;
}
};
} // namespace test
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#include <boost/core/ref.hpp>
#endif
int main()
{
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) || \
(10 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
test::C::evaluate(
test::lvalue_const_bitset<0>()
, test::lvalue_bitset<0>()
, test::rvalue_const_bitset<0>()
, test::rvalue_bitset<0>()
, test::lvalue_const_bitset<1>()
, test::lvalue_bitset<1>()
, test::rvalue_const_bitset<1>()
);
test::C::evaluate(
test::lvalue_const_bitset<0>()
, test::lvalue_bitset<0>()
, test::rvalue_const_bitset<0>()
, test::rvalue_bitset<0>()
, test::lvalue_const_bitset<1>()
, test::lvalue_bitset<1>()
, test::rvalue_const_bitset<1>()
, test::lvalue_const_bitset<2>()
, test::lvalue_bitset<2>()
, test::rvalue_bitset<2>()
);
#else // no perfect forwarding support and no exponential overloads
test::C::evaluate(
test::lvalue_const_bitset<0>()
, boost::ref(test::lvalue_bitset<0>())
, test::rvalue_const_bitset<0>()
, test::rvalue_bitset<0>()
, test::lvalue_const_bitset<1>()
, boost::ref(test::lvalue_bitset<1>())
, test::rvalue_const_bitset<1>()
);
test::C::evaluate(
test::lvalue_const_bitset<0>()
, boost::ref(test::lvalue_bitset<0>())
, test::rvalue_const_bitset<0>()
, test::rvalue_bitset<0>()
, test::lvalue_const_bitset<1>()
, boost::ref(test::lvalue_bitset<1>())
, test::rvalue_const_bitset<1>()
, test::lvalue_const_bitset<2>()
, boost::ref(test::lvalue_bitset<2>())
, test::rvalue_bitset<2>()
);
#endif // perfect forwarding support, or exponential overloads
return boost::report_errors();
}
|