Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

operator!= (<list>)

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

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


An object of type list.


An object of type list.

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

The comparison between list objects is based on a pairwise comparison of their elements. Two lists are equal if they have the same number of elements and their respective elements have the same values. Otherwise, they are unequal.

// list_op_ne.cpp
// compile with: /EHsc
#include <list>
#include <iostream>

int main( ) 
   using namespace std; 
   list <int> c1, c2;
   c1.push_back( 1 );
   c2.push_back( 2 );

   if ( c1 != c2 )
      cout << "Lists not equal." << endl;
      cout << "Lists equal." << endl;
Lists not equal.

Header: <list>

Namespace: std

Community Additions

© 2015 Microsoft