64 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_map>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_map14 15// template <typename K>16// iterator find(const K& k);17 18// UNSUPPORTED: c++03, c++11, c++14, c++1719 20#include <unordered_map>21 22#include "test_transparent_unordered.h"23 24int main(int, char**) {25 using key_type = StoredType<int>;26 27 {28 // Make sure conversions don't happen for transparent non-final hasher and key_equal29 using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<>>;30 test_transparent_find<M>({{1, 2}, {2, 3}});31 test_transparent_find<const M>({{1, 2}, {2, 3}});32 }33 34 {35 // Make sure conversions don't happen for transparent final hasher and key_equal36 using M = unord_map_type<std::unordered_map, transparent_hash_final, transparent_equal_final>;37 test_transparent_find<M>({{1, 2}, {2, 3}});38 test_transparent_find<const M>({{1, 2}, {2, 3}});39 }40 41 {42 // Make sure conversions do happen for non-transparent hasher43 using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<>>;44 test_non_transparent_find<M>({{1, 2}, {2, 3}});45 test_non_transparent_find<const M>({{1, 2}, {2, 3}});46 }47 48 {49 // Make sure conversions do happen for non-transparent key_equal50 using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<key_type>>;51 test_non_transparent_find<M>({{1, 2}, {2, 3}});52 test_non_transparent_find<const M>({{1, 2}, {2, 3}});53 }54 55 {56 // Make sure conversions do happen for both non-transparent hasher and key_equal57 using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<key_type>>;58 test_non_transparent_find<M>({{1, 2}, {2, 3}});59 test_non_transparent_find<const M>({{1, 2}, {2, 3}});60 }61 62 return 0;63}64