Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

operator== (<vector>)


Tests if the object on the left side of the operator is equal to the object on the right side.

      bool operator==(
   const vector<Type, Allocator>& _Left,
   const vector<Type, Allocator>& _Right


An object of type vector.


An object of type vector.

true if the vector on the left side of the operator is equal to the vector on the right side of the operator; otherwise false.

Two vectors are equal if they have the same number of elements and their respective elements have the same values. Otherwise, they are unequal.


// vector_op_eq.cpp
// compile with: /EHsc
#include <vector>
#include <iostream>

int main( )
   using namespace std; 

   vector <int> v1, v2;
   v1.push_back( 1 );
   v2.push_back( 1 );

   if ( v1 == v2 )
      cout << "Vectors equal." << endl;
      cout << "Vectors not equal." << endl;
Vectors equal.


Header: <vector>

Namespace: std

© 2016 Microsoft