Windows apps
Collapse the table of content
Expand the table of content
Information
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== (<list>)

 

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


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

_Left

An object of type list.

_Right

An object of type list.

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

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.

Example

// list_op_eq.cpp
// compile with: /EHsc
#include <list>
#include <iostream>
int main( ) 
{
   using namespace std; 

   list <int> c1, c2;
   c1.push_back( 1 );
   c2.push_back( 1 );

   if ( c1 == c2 )
      cout << "The lists are equal." << endl;
   else
      cout << "The lists are not equal." << endl;
}
The lists are equal.

Requirements

Header: <list>

Namespace: std

Show:
© 2016 Microsoft