21 May
2015
21 May
'15
9:21 a.m.
Hi list, I usually find useful an overload of this function to check whether all elements in a range are equal *to each other*. Something like: 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)); } Would this be a useful addition to Boost.Algorithm?