#include BOOST_PARAMETER_NAME(name) BOOST_PARAMETER_NAME(index) template #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) void noop(T&&) #else void noop(T&) #endif { } #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) #include #endif template #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) int deduce_arg_types_impl(Name&& name, Index&& index) { noop(std::forward(name)); noop(std::forward(index)); return index; } #else int deduce_arg_types_impl(Name& name, Index& index) { Name& n2 = name; // we know the types Index& i2 = index; noop(n2); noop(i2); return index; } #endif template int deduce_arg_types(ArgumentPack const& args) { return deduce_arg_types_impl(args[_name], args[_index|42]); } #include int main() { int a1 = deduce_arg_types((_name = "foo")); int a2 = deduce_arg_types((_name = "foo", _index = 3)); BOOST_TEST_EQ(a1, 42); BOOST_TEST_EQ(a2, 3); return boost::report_errors(); }