]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/parameter/test/maybe.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / parameter / test / maybe.cpp
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/keyword.hpp>
6 #include <boost/parameter/aux_/maybe.hpp>
7 #include <cassert>
8
9 namespace test {
10
11 BOOST_PARAMETER_KEYWORD(tag, kw)
12 BOOST_PARAMETER_KEYWORD(tag, unused)
13
14 template <class Args>
15 int f(Args const& args)
16 {
17 return args[kw | 1.f];
18 }
19
20 } // namespace test
21
22 int main()
23 {
24 using test::kw;
25 using test::unused;
26 using test::f;
27 using boost::parameter::aux::maybe;
28
29 assert(f((kw = 0, unused = 0)) == 0);
30 assert(f(unused = 0) == 1);
31 assert(f((kw = maybe<int>(), unused = 0)) == 1);
32 assert(f((kw = maybe<int>(2), unused = 0)) == 2);
33 return 0;
34 }
35