[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / libcxx / test / std / containers / unord / unord.map / equal_range_const.pass.cpp
blob3519fb531a1eedc9236d4734e6e20e27673e5f81
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 // pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
17 #include <unordered_map>
18 #include <string>
19 #include <cassert>
21 #include "test_macros.h"
22 #include "min_allocator.h"
24 int main(int, char**)
27 typedef std::unordered_map<int, std::string> C;
28 typedef C::const_iterator I;
29 typedef std::pair<int, std::string> P;
30 P a[] =
32 P(10, "ten"),
33 P(20, "twenty"),
34 P(30, "thirty"),
35 P(40, "forty"),
36 P(50, "fifty"),
37 P(60, "sixty"),
38 P(70, "seventy"),
39 P(80, "eighty"),
41 const C c(std::begin(a), std::end(a));
42 std::pair<I, I> r = c.equal_range(30);
43 assert(std::distance(r.first, r.second) == 1);
44 assert(r.first->first == 30);
45 assert(r.first->second == "thirty");
46 r = c.equal_range(5);
47 assert(std::distance(r.first, r.second) == 0);
49 #if TEST_STD_VER >= 11
51 typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
52 min_allocator<std::pair<const int, std::string>>> C;
53 typedef C::const_iterator I;
54 typedef std::pair<int, std::string> P;
55 P a[] =
57 P(10, "ten"),
58 P(20, "twenty"),
59 P(30, "thirty"),
60 P(40, "forty"),
61 P(50, "fifty"),
62 P(60, "sixty"),
63 P(70, "seventy"),
64 P(80, "eighty"),
66 const C c(std::begin(a), std::end(a));
67 std::pair<I, I> r = c.equal_range(30);
68 assert(std::distance(r.first, r.second) == 1);
69 assert(r.first->first == 30);
70 assert(r.first->second == "thirty");
71 r = c.equal_range(5);
72 assert(std::distance(r.first, r.second) == 0);
74 #endif
76 return 0;