operator!= (<vector>)

operator!= (<vector>)

Tests if the object on the left side of the operator is not 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 vectors are not equal; false if the vectors are equal.

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_ne.cpp
// compile with: /EHsc
#include <vector>
#include <iostream>

int main( ) 
   using namespace std; 
   vector <int> v1, v2;
   v1.push_back( 1 );
     v2.push_back( 2 );

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

Header: <vector>

Namespace: std

Community Additions

© 2015 Microsoft