]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/parameter/test/deduced.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / parameter / test / deduced.hpp
1 // Copyright Daniel Wallin 2006. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
5 #ifndef BOOST_DEDUCED_060920_HPP
6 # define BOOST_DEDUCED_060920_HPP
7
8 # include <boost/mpl/for_each.hpp>
9 # include "basics.hpp"
10
11 struct not_present_tag {};
12 not_present_tag not_present;
13
14 template <class E, class ArgPack>
15 struct assert_expected
16 {
17 assert_expected(E const& e, ArgPack const& args)
18 : expected(e)
19 , args(args)
20 {}
21
22 template <class T>
23 bool check_not_present(T const&) const
24 {
25 BOOST_MPL_ASSERT((boost::is_same<T,not_present_tag>));
26 return true;
27 }
28
29 template <class K>
30 bool check1(K const& k, not_present_tag const&, long) const
31 {
32 return check_not_present(args[k | not_present]);
33 }
34
35 template <class K, class Expected>
36 bool check1(K const& k, Expected const& expected, int) const
37 {
38 return test::equal(args[k], expected);
39 }
40
41 template <class K>
42 void operator()(K) const
43 {
44 boost::parameter::keyword<K> const& k = boost::parameter::keyword<K>::get();
45 assert(check1(k, expected[k], 0L));
46 }
47
48 E const& expected;
49 ArgPack const& args;
50 };
51
52 template <class E, class ArgPack>
53 void check0(E const& e, ArgPack const& args)
54 {
55 boost::mpl::for_each<E>(assert_expected<E,ArgPack>(e, args));
56 }
57
58 template <class P, class E, class A0>
59 void check(E const& e, A0 const& a0)
60 {
61 check0(e, P()(a0));
62 }
63
64 template <class P, class E, class A0, class A1>
65 void check(E const& e, A0 const& a0, A1 const& a1)
66 {
67 check0(e, P()(a0,a1));
68 }
69
70 template <class P, class E, class A0, class A1, class A2>
71 void check(E const& e, A0 const& a0, A1 const& a1, A2 const& a2)
72 {
73 check0(e, P()(a0,a1,a2));
74 }
75
76 #endif // BOOST_DEDUCED_060920_HPP
77