次の方法で共有


operator!= (multimap)

演算子の左側の map の map のオブジェクトが右側のオブジェクトと等しくないかどうかを調べます。

bool operator!=(
   const multimap <Key, Type, Traits, Allocator>& _Left,
   const multimap <Key, Type, Traits, Allocator>& _Right
);

パラメーター

  • _Left
    multimap 型のオブジェクト。

  • _Right
    multimap 型のオブジェクト。

戻り値

multimaps がではないtrue ; multimaps が等しい場合 false

解説

map オブジェクトの間の比較は、要素のペアに比較に基づいています。2 個の multimaps は、要素の数が同じで、対応する要素の値が同じ同じです。それ以外の場合は等しくありません。

使用例

// multimap_op_ne.cpp
// compile with: /EHsc
#include <map>
#include <iostream>

int main( )
{
   using namespace std;
   multimap <int, int> m1, m2, m3;
   int i;
   typedef pair <int, int> Int_Pair;

   for ( i = 0 ; i < 3 ; i++ )
   {
      m1.insert ( Int_Pair ( i, i ) );
      m2.insert ( Int_Pair ( i, i * i ) );
      m3.insert ( Int_Pair ( i, i ) );
   }

   if ( m1 != m2 )
      cout << "The multimaps m1 and m2 are not equal." << endl;
   else
      cout << "The multimaps m1 and m2 are equal." << endl;

   if ( m1 != m3 )
      cout << "The multimaps m1 and m3 are not equal." << endl;
   else
      cout << "The multimaps m1 and m3 are equal." << endl;
}
  
  

必要条件

ヘッダー: <map>

名前空間: std

参照

関連項目

標準テンプレート ライブラリ