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