1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
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_map
15 // template <typename K>
16 // bool contains(const K& x) const;
18 // UNSUPPORTED: c++03, c++11, c++14, c++17
20 #include <unordered_map>
21 #include "test_transparent_unordered.h"
25 using key_type
= StoredType
<int>;
26 using ilist_type
= std::initializer_list
<std::pair
<const key_type
, int> >;
29 // Make sure conversions don't happen for transparent non-final hasher and key_equal
30 using map_type
= const unord_map_type
<std::unordered_map
, transparent_hash
, std::equal_to
<> >;
31 test_transparent_contains
<map_type
>(ilist_type
{{1, 2}, {2, 3}});
35 // Make sure conversions don't happen for transparent final hasher and key_equal
36 using map_type
= const unord_map_type
<std::unordered_map
, transparent_hash_final
, transparent_equal_final
>;
37 test_transparent_contains
<map_type
>(ilist_type
{{1, 2}, {2, 3}});
41 // Make sure conversions do happen for non-transparent hasher
42 using map_type
= const unord_map_type
<std::unordered_map
, non_transparent_hash
,
44 test_non_transparent_contains
<map_type
>(ilist_type
{{1, 2}, {2, 3}});
48 // Make sure conversions do happen for non-transparent key_equal
49 using map_type
= const unord_map_type
<std::unordered_map
, transparent_hash
,
50 std::equal_to
<key_type
> >;
51 test_non_transparent_contains
<map_type
>(ilist_type
{{1, 2}, {2, 3}});
55 // Make sure conversions do happen for both non-transparent hasher and key_equal
56 using map_type
= const unord_map_type
<std::unordered_map
, non_transparent_hash
,
57 std::equal_to
<key_type
> >;
58 test_non_transparent_contains
<map_type
>(ilist_type
{{1, 2}, {2, 3}});