How can I make a class template that returns whether any of its variadic types are equal to the first type. I want to be able to do this:
is_same
Using the relaxed C++14 constexpr functions, these kinds of things are much easier to code, and probably much faster to compile as well, so you could write:
template
constexpr bool is_all_same() {
bool pairs[] = {std::is_same::value...};
for(bool p: pairs) if(!p) return false;
return true;
}
template
constexpr bool is_any_same() {
bool pairs[] = {std::is_same::value...};
for(bool p: pairs) if(p) return true;
return false;
}
This is enabled by the fact that in C++14 constexpr functions can have for loops.