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-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | // <unordered_set> |
10 | |
11 | // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, |
12 | // class Alloc = allocator<pair<const Key, T>>> |
13 | // class unordered_multiset |
14 | |
15 | // template <typename K> |
16 | // pair<const_iterator, const_iterator> equal_range(const K& k) const; |
17 | |
18 | // UNSUPPORTED: c++03, c++11, c++14, c++17 |
19 | |
20 | #include <unordered_set> |
21 | |
22 | #include "test_transparent_unordered.h" |
23 | |
24 | int main(int, char**) |
25 | { |
26 | using key_type = StoredType<int>; |
27 | |
28 | { |
29 | // Make sure conversions don't happen for transparent non-final hasher and key_equal |
30 | using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<>>; |
31 | test_transparent_equal_range<S>({1, 1, 2}); |
32 | test_transparent_equal_range<const S>({1, 1, 2}); |
33 | } |
34 | |
35 | { |
36 | // Make sure conversions don't happen for transparent final hasher and key_equal |
37 | using S = unord_set_type<std::unordered_multiset, transparent_hash_final, transparent_equal_final>; |
38 | test_transparent_equal_range<S>({1, 1, 2}); |
39 | test_transparent_equal_range<const S>({1, 1, 2}); |
40 | } |
41 | |
42 | { |
43 | // Make sure conversions do happen for non-transparent hasher |
44 | using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<>>; |
45 | test_non_transparent_equal_range<S>({1, 1, 2}); |
46 | test_non_transparent_equal_range<const S>({1, 1, 2}); |
47 | } |
48 | |
49 | { |
50 | // Make sure conversions do happen for non-transparent key_equal |
51 | using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<key_type>>; |
52 | test_non_transparent_equal_range<S>({1, 1, 2}); |
53 | test_non_transparent_equal_range<const S>({1, 1, 2}); |
54 | } |
55 | |
56 | { |
57 | // Make sure conversions do happen for both non-transparent hasher and key_equal |
58 | using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<key_type>>; |
59 | test_non_transparent_equal_range<S>({1, 1, 2}); |
60 | test_non_transparent_equal_range<const S>({1, 1, 2}); |
61 | } |
62 | |
63 | return 0; |
64 | } |
65 | |