63 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// <unordered_set>10 11// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,12// class Alloc = allocator<Value>>13// class unordered_multiset14 15// template <typename K>16// bool contains(const K& x) const;17 18// UNSUPPORTED: c++03, c++11, c++14, c++1719 20#include <unordered_set>21#include "test_transparent_unordered.h"22 23int main(int, char**) {24 using key_type = StoredType<int>;25 26 {27 // Make sure conversions don't happen for transparent non-final hasher and key_equal28 using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<>>;29 test_transparent_contains<S>({1, 1, 2});30 test_transparent_contains<const S>({1, 1, 2});31 }32 33 {34 // Make sure conversions don't happen for transparent final hasher and key_equal35 using S = unord_set_type<std::unordered_multiset, transparent_hash_final, transparent_equal_final>;36 test_transparent_contains<S>({1, 1, 2});37 test_transparent_contains<const S>({1, 1, 2});38 }39 40 {41 // Make sure conversions do happen for non-transparent hasher42 using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<>>;43 test_non_transparent_contains<S>({1, 1, 2});44 test_non_transparent_contains<const S>({1, 1, 2});45 }46 47 {48 // Make sure conversions do happen for non-transparent key_equal49 using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<key_type>>;50 test_non_transparent_contains<S>({1, 1, 2});51 test_non_transparent_contains<const S>({1, 1, 2});52 }53 54 {55 // Make sure conversions do happen for both non-transparent hasher and key_equal56 using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<key_type>>;57 test_non_transparent_contains<S>({1, 1, 2});58 test_non_transparent_contains<const S>({1, 1, 2});59 }60 61 return 0;62}63