operator!= (unordered_multiset)

测试运算符左侧的 unordered_multiset 对象是否等于右侧的 unordered_multiset 对象不等于。

bool operator!=( 
   const unordered_multiset <Key, Hash, Pred, Allocator>& _Left, 
   const unordered_multiset <Key, Hash, Pred, Allocator>& _Right 
);

参数

  • _Left
    unordered_multiset 类型的对象。

  • _Right
    unordered_multiset 类型的对象。

返回值

true,如果 unordered_multisets 不相等;false,如果它们相等。

备注

在 unordered_multiset 对象之间的比较不会使其受到影响。它们存储元素的任意顺序的。 两 unordered_multisets 相等,如果变量具有相同数量的元素,在容器的元素是元素的排列在其他容器中。 否则为不相等。

示例

// unordered_multiset_ne.cpp 
// compile by using: cl.exe /EHsc /nologo /W4 /MTd 
#include <unordered_set> 
#include <iostream> 
#include <ios>

int main() 
{ 
    using namespace std;

    unordered_multiset<char> c1, c2, c3;

    c1.insert('a'); 
    c1.insert('b'); 
    c1.insert('c'); 
    c1.insert('c'); 

    c2.insert('c'); 
    c2.insert('c'); 
    c2.insert('a'); 
    c2.insert('d'); 

    c3.insert('c'); 
    c3.insert('c'); 
    c3.insert('a'); 
    c3.insert('b'); 

   cout << boolalpha;
   cout << "c1 != c2: " << (c1 != c2) << endl; 
   cout << "c1 != c3: " << (c1 != c3) << endl; 
   cout << "c2 != c3: " << (c2 != c3) << endl; 

    return (0); 
} 

输出:

c1 != c2: true

c1 != c3: false

c2 != c3: true

要求

标头: <unordered_set>

命名空间: std

请参见

参考

标准模板库