]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/parameter/test/literate/lazy-default-computation0.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / parameter / test / literate / lazy-default-computation0.cpp
1
2 #include <boost/parameter.hpp>
3 #include <string>
4
5 BOOST_PARAMETER_NAME(s1)
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
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