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