]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/parameter/test/ntp.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / parameter / test / ntp.cpp
CommitLineData
7c673cae
FG
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#include <boost/parameter.hpp>
6#include <boost/mpl/assert.hpp>
7#include <boost/type_traits/is_same.hpp>
8#include <boost/type_traits/is_base_and_derived.hpp>
9
10namespace mpl = boost::mpl;
11namespace parameter = boost::parameter;
12
13template <class T = int>
14struct a0_is
15 : parameter::template_keyword<a0_is<>, T>
16{};
17
18template <class T = int>
19struct a1_is
20 : parameter::template_keyword<a1_is<>, T>
21{};
22
23template <class T = int>
24struct a2_is
25 : parameter::template_keyword<a2_is<>, T>
26{};
27
28template <class T = int>
29struct a3_is
30 : parameter::template_keyword<a3_is<>, T>
31{};
32
33struct X {};
34struct Y : X {};
35
36template <
37 class A0 = parameter::void_
38 , class A1 = parameter::void_
39 , class A2 = parameter::void_
40 , class A3 = parameter::void_
41>
42struct with_ntp
43{
44 typedef typename parameter::parameters<
45 a0_is<>, a1_is<>, a2_is<>
46 , parameter::optional<
47 parameter::deduced<a3_is<> >
48 , boost::is_base_and_derived<X, mpl::_>
49 >
50 >::bind<A0,A1,A2,A3
51#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
52 , parameter::void_
53#endif
54 >::type args;
55
56 typedef typename parameter::binding<
57 args, a0_is<>, void*
58 >::type a0;
59
60 typedef typename parameter::binding<
61 args, a1_is<>, void*
62 >::type a1;
63
64 typedef typename parameter::binding<
65 args, a2_is<>, void*
66 >::type a2;
67
68 typedef typename parameter::binding<
69 args, a3_is<>, void*
70 >::type a3;
71
72 typedef void(*type)(a0,a1,a2,a3);
73};
74
75BOOST_MPL_ASSERT((boost::is_same<
76 with_ntp<>::type, void(*)(void*,void*,void*,void*)
77>));
78
79BOOST_MPL_ASSERT((boost::is_same<
80 with_ntp<a2_is<int> >::type, void(*)(void*,void*,int,void*)
81>));
82
83BOOST_MPL_ASSERT((boost::is_same<
84 with_ntp<a1_is<int> >::type, void(*)(void*,int,void*,void*)
85>));
86
87BOOST_MPL_ASSERT((boost::is_same<
88 with_ntp<a2_is<int const>, a1_is<float> >::type, void(*)(void*,float,int const,void*)
89>));
90
91BOOST_MPL_ASSERT((boost::is_same<
92 with_ntp<int const>::type, void(*)(int const, void*, void*,void*)
93>));
94
95BOOST_MPL_ASSERT((boost::is_same<
96 with_ntp<int, float>::type, void(*)(int, float, void*,void*)
97>));
98
99BOOST_MPL_ASSERT((boost::is_same<
100 with_ntp<int, float, char>::type, void(*)(int, float, char,void*)
101>));
102
103BOOST_MPL_ASSERT((boost::is_same<
104 with_ntp<a0_is<int>, Y>::type, void(*)(int,void*,void*, Y)
105>));
106
107BOOST_MPL_ASSERT((boost::is_same<
108 with_ntp<int&, a2_is<char>, Y>::type, void(*)(int&,void*,char, Y)
109>));
110