21 May
2013
21 May
'13
8:50 p.m.
James Hirschorn wrote:
struct myclass_impl { template <class ArgumentPack> myclass_impl(ArgumentPack const& args) { std::cout << "name = " << args[_name] << "; index = " << args[_index] << std::endl; } };
I believe when you have an optional constructor parameter, you must access it with the default value supplied: struct myclass_impl { template <class ArgumentPack> myclass_impl(ArgumentPack const& args) { std::cout << "name = " << args[_name | ""] << "; index = " << args[_index | 0] << std::endl; } }; (Note the bitwise or "|"). This is a little different than for named function parameters, it seems. HTH, Nate