1 
2 #include <boost/bind.hpp>
3 #include <boost/ref.hpp>
4 #include <boost/parameter.hpp>
5 #include <string>
6 #include <functional>
7 
8 BOOST_PARAMETER_NAME(s1)
BOOST_PARAMETER_NAME(s2)9 BOOST_PARAMETER_NAME(s2)
10 BOOST_PARAMETER_NAME(s3)
11 
12 template <typename ArgumentPack>
13 std::string f(ArgumentPack const& args)
14 {
15     std::string const& s1 = args[_s1];
16     std::string const& s2 = args[_s2];
17     typename boost::parameter::binding<
18         ArgumentPack, tag::s3, std::string
19     >::type s3 = args[
20         _s3 || boost::bind(
21             std::plus<std::string>()
22           , boost::ref(s1)
23           , boost::ref(s2)
24         )
25     ];
26     return s3;
27 }
28 
29 #include <boost/core/lightweight_test.hpp>
30 
main()31 int main()
32 {
33     std::string x = f((_s1="hello,", _s2=" world", _s3="hi world"));
34     BOOST_TEST_EQ(x, std::string("hi world"));
35     return boost::report_errors();
36 }
37 
38