flat_multiset_operator_cmp
flat_multiset_operator_cmp (std::flat_multiset::operator==,operator<=> — 비교 연산자)
두 std::flat_multiset을 비교하는 비멤버 연산자 함수들이에요. 내부 적응 컨테이너의 내용을 서로 비교해요.
출처: cppreference
본문
시그니처는 다음과 같아요.
friend bool operator==( const std::flat_multiset& lhs,
const std::flat_multiset& rhs ); // (1) (since C++23)
friend synth-three-way-result<value_type>
operator<=>( const std::flat_multiset& lhs,
const std::flat_multiset& rhs ); // (2) (since C++23)
두 컨테이너 어댑터의 내부 컨테이너 내용을 비교해요. 해당 연산자를 내부 컨테이너에 적용해서 비교를 수행해요.
반환값
- (1) 해당 비교가
true이면true, 그렇지 않으면false. - (2) 내부 컨테이너에 대한 삼중 비교(three-way comparison) 결과.
복잡도
- (1)
lhs와rhs의 크기가 다르면 상수, 그렇지 않으면flat_multiset크기에 선형. - (2) 컨테이너 크기에 선형.
예제
#include <flat_set>
#include <iostream>
int main()
{
std::flat_multiset<int> a{1, 2};
std::flat_multiset<int> b{1, 2};
std::cout << std::boolalpha << (a == b) << '\n'; // true
}