operator>= (map)
如果在运算符左侧的映射对象大于或等于右侧,的映射对象测试。
bool operator>=(
const map <Key, Type, Traits, Allocator>& _Left,
const map <Key, Type, Traits, Allocator>& _Right
);
参数
_Left
类型 映射对象。_Right
类型 映射对象。
返回值
true,如果在运算符左侧的映射大于或等于映射列表中的右侧;否则 false。
备注
在映射对象之间的比较根据其元素的比较pairwise。 大于或等于两个对象之间的关系于比较的第一对不相等元素。
示例
// map_op_ge.cpp
// compile with: /EHsc
#include <map>
#include <iostream>
int main( )
{
using namespace std;
map < int, int > m1, m2, m3, m4;
int i;
typedef pair < int, int > Int_Pair;
for ( i = 1 ; i < 3 ; i++ )
{
m1.insert ( Int_Pair ( i, i ) );
m2.insert ( Int_Pair ( i, i * i ) );
m3.insert ( Int_Pair ( i, i - 1 ) );
m4.insert ( Int_Pair ( i, i ) );
}
if ( m1 >= m2 )
cout << "Map m1 is greater than or equal to map m2." << endl;
else
cout << "The map m1 is less than the map m2." << endl;
if ( m1 >= m3 )
cout << "Map m1 is greater than or equal to map m3." << endl;
else
cout << "The map m1 is less than the map m3." << endl;
if ( m1 >= m4 )
cout << "Map m1 is greater than or equal to map m4." << endl;
else
cout << "The map m1 is less than the map m4." << endl;
}
要求
标头: <map>
命名空间: std