0

I am trying to find an stl function that would be equivalent to the following snippet

template<typename T>
bool all_equal(const T* &p_firstElement, const T* &p_lastElement){
    const T firstValue = *(p_firstElement);
    T* iter = p_firstElement;
    
    do
    {
        if(*iter != firstValue)
            return false;

        ++iter;
    } while (iter < p_lastElement + 1);

    return true;
}

I am kind of surprised because I didn't found any stl method that would do the same, like std::all_equal(pointerToFirstElement, pointerToLastElement)...

so, my question is, is there any stl method that does that ?

tony_merguez
  • 307
  • 2
  • 11

0 Answers0