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

Parameters

  • _Left
    An object of type vector.

  • _Right
    An object of type vector.

Return Value

true if the vectors are not equal; false if the vectors are equal.

Remarks

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

Example

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

Vectors not equal.

Requirements

Header: <vector>

Namespace: std

See Also

Concepts

<vector> Members

Standard Template Library