【发布时间】:2018-11-22 08:02:06
【问题描述】:
我找不到让它工作的方法。甚至可能吗?我不明白为什么不会。
template <auto id, typename FirstField, typename... OtherFields>
struct FieldTypeById {
using Type = int;
};
template <auto id>
struct FieldTypeById<id, void> {
using Type = void;
};
int main()
{
using t1 = FieldTypeById<0, int>::Type;
using t2 = FieldTypeById<1>::Type;
return 0;
}
【问题讨论】:
标签: c++ templates c++17 template-specialization