I usually find useful an overload of this function to check whether all elements in a range are equal *to each other*.
template <typename Range>
bool all_of_equal(const Range & r)
{
// return true on empty range
if (boost::empty(r)) return true;
// return true if all other elements are equal to the first element
return boost::all_of_equal( boost::next( boost::begin(r) ), boost::end(r), *boost::begin(r));
}