我正在编写一个模板,它接受任意数量的参数,并在这些值上找到布尔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> {};
Run Code Online (Sandbox Code Playgroud)
但是,我无法通过以下消息进行编译
error: redeclared with 2 template parameters
struct meta_bool_and : std::integral_constant<bool, V && meta_bool_and<Vs...>::value> {};
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
c++ templates partial-specialization variadic-templates c++11