[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / containers / unord / unord.map / compare.pass.cpp
blob200107cddf12a25fc869a6a60dd4c8436ee2bbc8
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 //===----------------------------------------------------------------------===//
9 // <unordered_map>
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 // https://llvm.org/PR16538
16 // https://llvm.org/PR16549
18 #include <unordered_map>
19 #include <cassert>
21 #include "test_macros.h"
23 struct Key {
24 template <typename T> Key(const T&) {}
25 bool operator== (const Key&) const { return true; }
28 namespace std
30 template <>
31 struct hash<Key>
33 std::size_t operator()(Key const &) const {return 0;}
37 int main(int, char**)
39 typedef std::unordered_map<Key, int> MapT;
40 typedef MapT::iterator Iter;
41 MapT map;
42 Iter it = map.find(Key(0));
43 assert(it == map.end());
44 std::pair<Iter, bool> result = map.insert(std::make_pair(Key(0), 42));
45 assert(result.second);
46 assert(result.first->second == 42);
48 return 0;