I am using std::equals
defined in <algorithm>
to check if two vectors are equal. It crashes when second vector is empty. I could avoid crash by checking if second vector is empty, but is there a reason to not include the check in equal
function itself ?
Sample code:
std::vector<int> a;
for (int i = 0; i < 3; ++i) a.emplace_back(i);
std::vector<int> b;
for (int i = 0; i < 0; ++i) b.emplace_back(i);
std::equal(a.begin(), a.end(), b.begin());