operator== (multiset)
演算子の左側のマルチセット オブジェクトが右側のマルチセット オブジェクトと等しいかどうかをテストします。
bool operator!==(
const multiset <Key, Traits, Allocator>& _Left,
const multiset <Key, Traits, Allocator>& _Right
);
パラメーター
_Left
multiset 型のオブジェクト。_Right
multiset 型のオブジェクト。
戻り値
演算子の左側のマルチセットが演算子の右側のマルチセットと等しいtrue ; それ false。
解説
マルチセット オブジェクトの比較は要素の比較に一対に基づいています。 要素の数が同じであり、それぞれの要素の値が同じである 2 個の設定またはマルチセットは同等です。 それ以外の場合は等しくありません。
使用例
// multiset_op_eq.cpp
// compile with: /EHsc
#include <set>
#include <iostream>
int main( )
{
using namespace std;
multiset <int> s1, s2, s3;
int i;
for ( i = 0 ; i < 3 ; i++ )
{
s1.insert ( i );
s2.insert ( i * i );
s3.insert ( i );
}
if ( s1 == s2 )
cout << "The multisets s1 and s2 are equal." << endl;
else
cout << "The multisets s1 and s2 are not equal." << endl;
if ( s1 == s3 )
cout << "The multisets s1 and s3 are equal." << endl;
else
cout << "The multisets s1 and s3 are not equal." << endl;
}
必要条件
ヘッダー: <set>
名前空間: std