小编Abd*_*dan的帖子

有没有办法在C++模板专业化中将条件置于常量值参数?

有没有办法将整数模板参数限制为专门化而不是代码冗余?

// redundant code

template <int N>
struct A {};
template <>
struct A <0> {};
template <>
struct A <1> {};

// what i want is some thing like this

template <int N>
struct A {};

template <>
struct A <N < 2> {};
Run Code Online (Sandbox Code Playgroud)

c++ templates

3
推荐指数
1
解决办法
329
查看次数

标签 统计

c++ ×1

templates ×1