File: evaluate_category_16.cpp

package info (click to toggle)
boost1.74 1.74.0-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 464,084 kB
  • sloc: cpp: 3,338,324; xml: 131,293; python: 33,088; ansic: 14,336; asm: 4,034; sh: 3,351; makefile: 1,193; perl: 1,036; yacc: 478; php: 212; ruby: 102; lisp: 24; sql: 13; csh: 6
file content (248 lines) | stat: -rw-r--r-- 9,162 bytes parent folder | download | duplicates (10)
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
// 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 < 16)
#error Define BOOST_PARAMETER_MAX_ARITY as 16 or greater.
#endif

#include <boost/parameter/name.hpp>

namespace test {

    BOOST_PARAMETER_NAME((_lrc0, keywords) in(lrc0))
    BOOST_PARAMETER_NAME((_lr1, keywords) out(lr1))
    BOOST_PARAMETER_NAME((_lr2, keywords) out(lr2))
    BOOST_PARAMETER_NAME((_lrc3, keywords) in(lrc3))
    BOOST_PARAMETER_NAME((_lrc4, keywords) in(lrc4))
    BOOST_PARAMETER_NAME((_lr5, keywords) out(lr5))
    BOOST_PARAMETER_NAME((_lr6, keywords) out(lr6))
    BOOST_PARAMETER_NAME((_lrc7, keywords) in(lrc7))
    BOOST_PARAMETER_NAME((_rrc0, keywords) in(rrc0))
    BOOST_PARAMETER_NAME((_rrc1, keywords) in(rrc1))
    BOOST_PARAMETER_NAME((_rrc2, keywords) in(rrc2))
    BOOST_PARAMETER_NAME((_rrc3, keywords) in(rrc3))
    BOOST_PARAMETER_NAME((_rrc4, keywords) in(rrc4))
    BOOST_PARAMETER_NAME((_rrc5, keywords) in(rrc5))
    BOOST_PARAMETER_NAME((_rrc6, keywords) in(rrc6))
    BOOST_PARAMETER_NAME((_rrc7, keywords) in(rrc7))
} // namespace test

#include <boost/parameter/parameters.hpp>
#include <boost/parameter/required.hpp>
#include <boost/parameter/optional.hpp>

namespace test {

    struct h_parameters
      : boost::parameter::parameters<
            boost::parameter::required<test::keywords::lrc0>
          , boost::parameter::required<test::keywords::rrc0>
          , boost::parameter::required<test::keywords::lr1>
          , boost::parameter::required<test::keywords::rrc1>
          , boost::parameter::required<test::keywords::lr2>
          , boost::parameter::required<test::keywords::rrc2>
          , boost::parameter::required<test::keywords::lrc3>
          , boost::parameter::required<test::keywords::rrc3>
          , boost::parameter::optional<test::keywords::lrc4>
          , boost::parameter::optional<test::keywords::rrc4>
          , boost::parameter::optional<test::keywords::lr5>
          , boost::parameter::optional<test::keywords::rrc5>
          , boost::parameter::optional<test::keywords::lr6>
          , boost::parameter::optional<test::keywords::rrc6>
          , boost::parameter::optional<test::keywords::lrc7>
          , boost::parameter::optional<test::keywords::rrc7>
        >
    {
    };
} // namespace test

#include <boost/core/lightweight_test.hpp>
#include "evaluate_category.hpp"

namespace test {

    struct D
    {
        template <typename Args>
        static void evaluate(Args const& args)
        {
            BOOST_TEST_EQ(
                test::passed_by_lvalue_reference_to_const
              , test::U::evaluate_category<0>(args[test::_lrc0])
            );
            BOOST_TEST_EQ(
                test::passed_by_lvalue_reference
              , test::U::evaluate_category<1>(args[test::_lr1])
            );
            BOOST_TEST_EQ(
                test::passed_by_lvalue_reference
              , test::U::evaluate_category<2>(args[test::_lr2])
            );
            BOOST_TEST_EQ(
                test::passed_by_lvalue_reference_to_const
              , test::U::evaluate_category<3>(args[test::_lrc3])
            );
            BOOST_TEST_EQ(
                test::passed_by_lvalue_reference_to_const
              , test::U::evaluate_category<4>(
                    args[test::_lrc4 | test::lvalue_const_bitset<4>()]
                )
            );
            BOOST_TEST_EQ(
                test::passed_by_lvalue_reference
              , test::U::evaluate_category<5>(
                    args[
                        test::_lr5 || test::lvalue_bitset_function<5>()
                    ]
                )
            );
            BOOST_TEST_EQ(
                test::passed_by_lvalue_reference
              , test::U::evaluate_category<6>(
                    args[test::_lr6 | test::lvalue_bitset<6>()]
                )
            );
            BOOST_TEST_EQ(
                test::passed_by_lvalue_reference_to_const
              , test::U::evaluate_category<7>(
                    args[
                        test::_lrc7 || test::lvalue_const_bitset_function<7>()
                    ]
                )
            );
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
            BOOST_TEST_EQ(
                test::passed_by_rvalue_reference_to_const
              , test::U::evaluate_category<0>(args[test::_rrc0])
            );
            BOOST_TEST_EQ(
                test::passed_by_rvalue_reference_to_const
              , test::U::evaluate_category<1>(args[test::_rrc1])
            );
            BOOST_TEST_EQ(
                test::passed_by_rvalue_reference_to_const
              , test::U::evaluate_category<2>(args[test::_rrc2])
            );
            BOOST_TEST_EQ(
                test::passed_by_rvalue_reference_to_const
              , test::U::evaluate_category<3>(args[test::_rrc3])
            );
            BOOST_TEST_EQ(
                test::passed_by_rvalue_reference_to_const
              , test::U::evaluate_category<4>(
                    args[test::_rrc4 | test::rvalue_const_bitset<4>()]
                )
            );
            BOOST_TEST_EQ(
                test::passed_by_rvalue_reference_to_const
              , test::U::evaluate_category<5>(
                    args[
                        test::_rrc5 || test::rvalue_const_bitset_function<5>()
                    ]
                )
            );
            BOOST_TEST_EQ(
                test::passed_by_rvalue_reference_to_const
              , test::U::evaluate_category<6>(
                    args[test::_rrc6 | test::rvalue_const_bitset<6>()]
                )
            );
            BOOST_TEST_EQ(
                test::passed_by_rvalue_reference_to_const
              , test::U::evaluate_category<7>(
                    args[
                        test::_rrc7 || test::rvalue_const_bitset_function<7>()
                    ]
                )
            );
#else   // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
            BOOST_TEST_EQ(
                test::passed_by_lvalue_reference_to_const
              , test::U::evaluate_category<0>(args[test::_rrc0])
            );
            BOOST_TEST_EQ(
                test::passed_by_lvalue_reference_to_const
              , test::U::evaluate_category<1>(args[test::_rrc1])
            );
            BOOST_TEST_EQ(
                test::passed_by_lvalue_reference_to_const
              , test::U::evaluate_category<2>(args[test::_rrc2])
            );
            BOOST_TEST_EQ(
                test::passed_by_lvalue_reference_to_const
              , test::U::evaluate_category<3>(args[test::_rrc3])
            );
            BOOST_TEST_EQ(
                test::passed_by_lvalue_reference_to_const
              , test::U::evaluate_category<4>(
                    args[test::_rrc4 | test::rvalue_const_bitset<4>()]
                )
            );
            BOOST_TEST_EQ(
                test::passed_by_lvalue_reference_to_const
              , test::U::evaluate_category<5>(
                    args[
                        test::_rrc5 || test::rvalue_const_bitset_function<5>()
                    ]
                )
            );
            BOOST_TEST_EQ(
                test::passed_by_lvalue_reference_to_const
              , test::U::evaluate_category<6>(
                    args[test::_rrc6 | test::rvalue_const_bitset<6>()]
                )
            );
            BOOST_TEST_EQ(
                test::passed_by_lvalue_reference_to_const
              , test::U::evaluate_category<7>(
                    args[
                        test::_rrc7 || test::rvalue_const_bitset_function<7>()
                    ]
                )
            );
#endif  // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
        }
    };
} // namespace test

int main()
{
    test::D::evaluate(
        test::h_parameters()(
            test::lvalue_const_bitset<0>()
          , test::rvalue_const_bitset<0>()
          , test::lvalue_bitset<1>()
          , test::rvalue_const_bitset<1>()
          , test::lvalue_bitset<2>()
          , test::rvalue_const_bitset<2>()
          , test::lvalue_const_bitset<3>()
          , test::rvalue_const_bitset<3>()
        )
    );
    test::D::evaluate(
        test::h_parameters()(
            test::lvalue_const_bitset<0>()
          , test::rvalue_const_bitset<0>()
          , test::lvalue_bitset<1>()
          , test::rvalue_const_bitset<1>()
          , test::lvalue_bitset<2>()
          , test::rvalue_const_bitset<2>()
          , test::lvalue_const_bitset<3>()
          , test::rvalue_const_bitset<3>()
          , test::lvalue_const_bitset<4>()
          , test::rvalue_const_bitset<4>()
          , test::lvalue_bitset<5>()
          , test::rvalue_const_bitset<5>()
          , test::lvalue_bitset<6>()
          , test::rvalue_const_bitset<6>()
          , test::lvalue_const_bitset<7>()
          , test::rvalue_const_bitset<7>()
        )
    );
    return boost::report_errors();
}