First example:
int main(){
using namespace std;
vector v1{10, 20, 30, 40, 50};
vector v2{10, 20, 30, 40, 50};
if(v1==v2
Yes. A good reference is cppreference.com, where you can look up operator==
for vector
, for example on this page: non-member operators, and you will find:
Checks if the contents of lhs and rhs are equal, that is, whether lhs.size() == rhs.size() and each element in lhs has equivalent element in rhs at the same position.