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

请参见

参考

标准模板库