Listing 2: A function with default arguments
// Declaration // =========== typedef make_parameter_tuple_type<int, const X&, int>::ret FooParams; // arg1 = 42 // arg2 = mandatory // arg3 = 43 template<typename ParameterTuple> void Foo(const ParameterTuple& args); // Definition // ========== template<typename ParameterTuple> void Foo(const ParameterTuple& client_args) { typedef make_parameter_tuple_type< int, mandatory_parameter_tag, int>::ret FooDefaultParams; FooDefaultParams default_args(42, mandatory_parameter_tag(), 43); FooParams args(client_args, default_args); FooInternal( args.get_parameter<0>(), args.get_parameter<1>(), args.get_parameter<2>() ); }