Export (0) Print
Expand All

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 
);

_Left

An object of type vector.

_Right

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;
   else
      cout << "Vectors not equal." << endl;
}
Vectors equal.

Header: <vector>

Namespace: std

Show:
© 2014 Microsoft