【发布时间】:2016-05-10 20:14:43
【问题描述】:
我正在编写一个模板,它接受任意数量的参数并在这些值上找到布尔 AND。
template <bool... Vs> struct meta_bool_and;
template <bool V> struct meta_bool_and : std::integral_constant<bool, V> {};
template <bool V, bool... Vs>
struct meta_bool_and : std::integral_constant<bool, V && meta_bool_and<Vs...>::value> {};
但是,我通过以下消息编译失败
error: redeclared with 2 template parameters
struct meta_bool_and : std::integral_constant<bool, V && meta_bool_and<Vs...>::value> {};
我该如何解决这个问题?
【问题讨论】:
标签: c++ templates c++11 variadic-templates partial-specialization