다음을 통해 공유


operator== (unordered_multiset)

Tests whether the unordered_multiset object on the left side of the operator is equal to the unordered_multiset object on the right side.

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 if the unordered_multisets are equal; false if they are not equal.

설명

The comparison between unordered_multiset objects is not affected by the arbitrary order in which they store their elements. Two unordered_multisets are equal if they have the same number of elements and the elements in one container are a permutation of the elements in the other container. 그렇지 않으면 두 개체는 서로 다른 개체입니다.

예제

// unordered_multiset_eq.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: false

c1 == c3: true

c2 == c3: false

요구 사항

헤더: <unordered_set>

네임스페이스: std

참고 항목

참조

표준 템플릿 라이브러리