共用方式為


operator!= (<list>)

測試運算子左邊的清單物件是否不等於右邊的清單物件。

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

參數

  • _Left
    list 類型的物件。

  • _Right
    list 類型的物件。

傳回值

如果清單不相等為 true;如果 list 相等為 false

備註

list 物件之間的比較是以其元素的成對比較為基礎。 如果有相同數目的元素,且個別元素擁有相同的值,則兩個清單相等。 反之則為不相等。

範例

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

需求

標頭:<list>

命名空間: std

請參閱

參考

list 類別

標準樣板程式庫