I would like to call a function using named parameters where I construct the
values from two different argument packs. How do I write a function that
will generically take the union of all of the named parameters? I am using
Intel C++ 11.1 with C++0X features turned on, so 'decltype' and 'auto' are
kosher, but not alternative function syntax. Also, the types I might have
in the args could be by value or reference or constant reference, so I can't
just copy them all by value.
Here is a simple example to see what I mean:
BOOST_PARAMETER_NAME(name1)
BOOST_PARAMETER_NAME(name2)
BOOST_PARAMETER_NAME(name3)
template<typename ArgPack>
double f(const ArgPack& args)
{
return args[_name1] + args[_name2] + args[_name3];
}
//Test using the argpack directly... this works fine.
std::cout << f(
(_name1 = 1.0, _name2 = 1.0, _name3 = 1.0)
);
//Now try to combine them:
template