1 | // Copyright Daniel Wallin 2006. |
---|---|
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/name.hpp> |
7 | |
8 | namespace test { |
9 | |
10 | BOOST_PARAMETER_NAME(kw) |
11 | BOOST_PARAMETER_NAME(unused) |
12 | |
13 | template <typename Args> |
14 | int f(Args const& args) |
15 | { |
16 | return args[test::_kw | 1.f]; |
17 | } |
18 | } // namespace test |
19 | |
20 | #include <boost/parameter/aux_/maybe.hpp> |
21 | #include <boost/core/lightweight_test.hpp> |
22 | |
23 | int main() |
24 | { |
25 | BOOST_TEST_EQ(0, test::f((test::_kw = 0, test::_unused = 0))); |
26 | BOOST_TEST_EQ(1, test::f(test::_unused = 0)); |
27 | BOOST_TEST_EQ( |
28 | 1 |
29 | , test::f(( |
30 | test::_kw = boost::parameter::aux::maybe<int>() |
31 | , test::_unused = 0 |
32 | )) |
33 | ); |
34 | BOOST_TEST_EQ( |
35 | 2 |
36 | , test::f(( |
37 | test::_kw = boost::parameter::aux::maybe<int>(2) |
38 | , test::_unused = 0 |
39 | )) |
40 | ); |
41 | return boost::report_errors(); |
42 | } |
43 | |
44 |