В этой статье описывается метод, который можно использовать для эмуляции именованных параметров шаблона.
Пример синтаксиса:
enum class bars { bar1, bar2, bar3 };
// Omitted definitions of get_value, is_present, get_type, a, b, c and d.
template <typename... Args>
struct foo {
static constexpr auto A = get_value<a<1>, Args...>::value;
static constexpr auto B = get_value<b<bars::bar2>, Args...>::value;
static constexpr auto C = is_present<c, Args...>::value;
using D = typename get_type<d<char>, Args...>::value;
};
// Client code
foo<d<float>, a<42>> f;
// f::A equals to 42;
// f::B equals to defaulted bars::bar2;
// f::C equals to false, because c is not present among temlate arguments;
// f::D equals to float