In C++11, you could use variadic templates to define your own function:
#include
template
bool all_equal(T&& t, U&& u)
{
return (t == u);
}
template
bool all_equal(T&& t, U&& u, Ts&&... args)
{
return (t == u) && all_equal(u, std::forward(args)...);
}
int main()
{
int x = 42;
int y = 42
std::cout << all_equal(42, y, x);
}