First example:
int main(){
using namespace std;
vector v1{10, 20, 30, 40, 50};
vector v2{10, 20, 30, 40, 50};
if(v1==v2
As long as your vector contains elements that in themselves can be compared (have operator==
), this works, yes. Note however that if you have a vector that contains for example pointers to identical objects, but not the SAME instance of an object, then the vector is not considered identical, because the element in the vector is what is compared, not the contents of the element as such, if that makes sense.