operator>= (set)
測試,如果在運算子左方的集合物件是大於或等於右邊的集合物件。
bool operator!>=(
const set <Key, Traits, Allocator>& _Left,
const set <Key, Traits, Allocator>& _Right
);
參數
_Left
型別 set物件。_Right
型別 set物件。
傳回值
true ,如果在運算子左方的集合是大於或等於這個集合在清單的右邊;否則 false。
備註
集合中物件之間的比較可能會依據其項目比較配對。 大於或等於兩個物件之間的關聯性會根據第一個要比較不相等的項目。
範例
// set_op_ge.cpp
// compile with: /EHsc
#include <set>
#include <iostream>
int main( )
{
using namespace std;
set <int> s1, s2, s3, s4;
int i;
for ( i = 0 ; i < 3 ; i++ )
{
s1.insert ( i );
s2.insert ( i * i );
s3.insert ( i - 1 );
s4.insert ( i );
}
if ( s1 >= s2 )
cout << "Set s1 is greater than or equal to set s2." << endl;
else
cout << "The set s1 is less than the set s2." << endl;
if ( s1 >= s3 )
cout << "Set s1 is greater than or equal to set s3." << endl;
else
cout << "The set s1 is less than the set s3." << endl;
if ( s1 >= s4 )
cout << "Set s1 is greater than or equal to set s4." << endl;
else
cout << "The set s1 is less than the set s4." << endl;
}
需求
標頭: <set>
命名空間: std