Is there any way to compare two vectors?
if (vector1 == vector2)
DoSomething();
Note: Currently, these vectors are not sorted and contain integer values.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Check out the
std::mismatchmethod of C++.Comparing vectors has been discussed on DaniWeb forum and also answered:
C++: Comparing two vectors
Check out the below SO post. It will be helpful to you. They have achieved the same with two different methods.
How do I get the number of different or common elements between two vectors of strings?