]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/parameter/test/macros.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / parameter / test / macros.cpp
1 // Copyright David Abrahams, Daniel Wallin 2003.
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.hpp>
7 #include <boost/parameter/macros.hpp>
8 #include <boost/bind/bind.hpp>
9 #include "basics.hpp"
10
11 namespace test {
12
13 BOOST_PARAMETER_FUN(int, f, 2, 4, f_parameters)
14 {
15 p[test::_tester](
16 p[test::_name]
17 , p[test::_value || boost::bind(&test::value_default)]
18 , p[test::_index | 999]
19 );
20
21 return 1;
22 }
23
24 BOOST_PARAMETER_NAME(foo)
25 BOOST_PARAMETER_NAME(bar)
26
27 struct baz_parameters
28 : boost::parameter::parameters<
29 boost::parameter::optional<test::tag::foo>
30 , boost::parameter::optional<test::tag::bar>
31 >
32 {
33 };
34
35 BOOST_PARAMETER_FUN(int, baz, 0, 2, baz_parameters)
36 {
37 return 1;
38 }
39 } // namespace test
40
41 #include <boost/core/ref.hpp>
42 #include <boost/core/lightweight_test.hpp>
43 #include <string>
44
45 int main()
46 {
47 test::f(
48 test::values(
49 std::string("foo")
50 , std::string("bar")
51 , std::string("baz")
52 )
53 , std::string("foo")
54 , std::string("bar")
55 , std::string("baz")
56 );
57 BOOST_TEST_EQ(1, test::baz());
58
59 int x = 56;
60 test::f(
61 test::values(std::string("foo"), 666.222, 56)
62 , test::_index = boost::ref(x)
63 , test::_name = std::string("foo")
64 );
65
66 return boost::report_errors();
67 }