1// Copyright David Abrahams, Daniel Wallin 2003.
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.hpp>
7#include <boost/parameter/macros.hpp>
8#include <boost/bind/bind.hpp>
9#include "basics.hpp"
10
11namespace test {
12
13 BOOST_PARAMETER_FUN(int, f, 2, 4, f_parameters)
14 {
15 p[test::_tester](
16 p[test::_name]
17 , p[test::_value || boost::bind(f: &test::value_default)]
18 , p[test::_index | 999]
19 );
20
21 return 1;
22 }
23
24 BOOST_PARAMETER_NAME(foo)
25 BOOST_PARAMETER_NAME(bar)
26
27 struct baz_parameters
28 : boost::parameter::parameters<
29 boost::parameter::optional<test::tag::foo>
30 , boost::parameter::optional<test::tag::bar>
31 >
32 {
33 };
34
35 BOOST_PARAMETER_FUN(int, baz, 0, 2, baz_parameters)
36 {
37 return 1;
38 }
39} // namespace test
40
41#include <boost/core/ref.hpp>
42#include <boost/core/lightweight_test.hpp>
43#include <string>
44
45int main()
46{
47 test::f(
48 p0: test::values(
49 n: std::string("foo")
50 , v: std::string("bar")
51 , i: std::string("baz")
52 )
53 , p1: std::string("foo")
54 , p2: std::string("bar")
55 , p3: std::string("baz")
56 );
57 BOOST_TEST_EQ(1, test::baz());
58
59 int x = 56;
60 test::f(
61 p0: test::values(n: std::string("foo"), v: 666.222, i: 56)
62 , p1: test::_index = boost::ref(t&: x)
63 , p2: test::_name = std::string("foo")
64 );
65
66 return boost::report_errors();
67}
68

source code of boost/libs/parameter/test/macros.cpp