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