How to check if a vector of vectors has all same values

  arrays, c++, equals, if-statement, vector

To check if a vector has all equal values i usually do this:

std::vector<bool> myVec(3);

if(std::adjacent_find(myVec.begin(), myVec.end(), std::not_equal_to<>()) == myVec.end()){
    // do if every value is the same
}

How can i use it to check if a vector of vectors has all equal values? This would be the case:

 std::vector<std::vector<bool>> my2DVec(3, std::vector<bool>(3));

Source: Windows Questions C++

LEAVE A COMMENT