c++11 - Variadic template aliases or functions? -
supposing 1 needs obtain logical value based on pack of template parameters, there reason prefer alias approach vs function approach?
example:
template<bool...> struct bool_pack; template<bool... bs> using all_true = std::is_same<bool_pack<bs..., true>, bool_pack<true, bs...>>;
as opposed to
template<class none=void> constexpr bool all_true() { return true; } template<bool first, bool... rest> constexpr bool all_true() { return first , all_true<rest...>(); }
Comments
Post a Comment