共用方式為


operator< (<list>)

測試,如果左側的清單物件大於右邊的清單物件。

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

參數

  • _Left
    型別 list物件。

  • _Right
    型別 list物件。

傳回值

true ,如果左側的清單不小於,但是等於清單在運算子的右邊,否則 false

備註

在 清單中物件之間的比較可能會依據其項目比較配對方式。 小於比較兩個物件之間的關聯性會在第一次對的比較不相等的項目。

範例

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

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

   c2.push_back( 1 );
   c2.push_back( 3 );

   if ( c1 < c2 )
      cout << "List c1 is less than list c2." << endl;
   else
      cout << "List c1 is not less than list c2." << endl;
}
  

需求

標題: <list>

命名空間: std

請參閱

參考

標準樣板程式庫