]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/parameter/test/deduced.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / parameter / test / deduced.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/parameters.hpp>
6#include <boost/parameter/name.hpp>
7#include <boost/parameter/binding.hpp>
8#include "deduced.hpp"
9
10namespace parameter = boost::parameter;
11namespace mpl = boost::mpl;
12
13BOOST_PARAMETER_NAME(x)
14BOOST_PARAMETER_NAME(y)
15BOOST_PARAMETER_NAME(z)
16
17int main()
18{
19 using namespace parameter;
20
21 check<
22 parameters<
23 tag::x
24 , tag::y
25 >
26 >(
27 (_x = 0, _y = 1)
28 , 0
29 , 1
30 );
31
32 check<
33 parameters<
34 tag::x
35 , required<deduced<tag::y>, boost::is_convertible<mpl::_, int> >
36 , optional<deduced<tag::z>, boost::is_convertible<mpl::_, char const*> >
37 >
38 >(
39 (_x = 0, _y = not_present, _z = "foo")
40 , _x = 0
41 , "foo"
42 );
43
44 check<
45 parameters<
46 tag::x
47 , required<deduced<tag::y>, boost::is_convertible<mpl::_, int> >
48 , optional<deduced<tag::z>, boost::is_convertible<mpl::_, char const*> >
49 >
50 >(
51 (_x = 0, _y = 1, _z = "foo")
52 , 0
53 , "foo"
54 , 1
55 );
56
57 check<
58 parameters<
59 tag::x
60 , required<deduced<tag::y>, boost::is_convertible<mpl::_, int> >
61 , optional<deduced<tag::z>, boost::is_convertible<mpl::_, char const*> >
62 >
63 >(
64 (_x = 0, _y = 1, _z = "foo")
65 , 0
66 , 1
67 , "foo"
68 );
69
70 check<
71 parameters<
72 tag::x
73 , required<deduced<tag::y>, boost::is_convertible<mpl::_, int> >
74 , optional<deduced<tag::z>, boost::is_convertible<mpl::_, char const*> >
75 >
76 >(
77 (_x = 0, _y = 1, _z = "foo")
78 , 0
79 , _y = 1
80 , "foo"
81 );
82
83 check<
84 parameters<
85 tag::x
86 , required<deduced<tag::y>, boost::is_convertible<mpl::_, int> >
87 , optional<deduced<tag::z>, boost::is_convertible<mpl::_, char const*> >
88 >
89 >(
90 (_x = 0, _y = 1, _z = "foo")
91 , _z = "foo"
92 , _x = 0
93 , 1
94 );
95
96 // Fails becasue of parameters.hpp:428
97/*
98 check<
99 parameters<
100 tag::x
101 , required<deduced<tag::y>, boost::is_convertible<mpl::_, int> >
102 , optional<deduced<tag::z>, boost::is_convertible<mpl::_, char const*> >
103 >
104 >(
105 (_x = 0, _y = 1, _z = "foo")
106 , _x = 0
107 , (long*)0
108 , 1
109 );
110*/
111
112 return 0;
113};
114