Unlike normal C/C++ arrays, we don’t need to do element by element comparison to find if two given vectors contain same elements or not.
In case of vectors, the operator “==” is overloaded to find the result quickly. Below is an example to demonstrate same.
Equal Not Equal Not Equal Equal
This article is contributed by Sachin Bisht. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- How to quickly swap two arrays of same size in C++?
- Quickly merging two sorted arrays using std::merge() in C++ STL
- How to join two Vectors using STL in C++?
- Working with Array and Vectors using STL in C++
- Difference between std::remove and vector::erase for vectors
- Check all the elements in an array are even using library in C++
- Sum of all elements between k1'th and k2'th smallest elements
- Get first and last elements from Array and Vector in CPP
- How to find the sum of elements of a Vector using STL in C++?
- How to find the sum of elements of an Array using STL in C++?
- How to insert elements in C++ STL List ?
- Delete elements in C++ STL list
- Elements present in first array and not in second using STL in C++
- Fibonacci sum of a subset with all elements <= k
- Find elements of an Array which are Odd and Even using STL in C++