[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / containers / unord / unord.multiset / equal_range_const.pass.cpp
blob6ef53875fcbcb0dffd9263e9f954e3ea1a28cedb
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_set>
11 // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
12 // class Alloc = allocator<Value>>
13 // class unordered_multiset
15 // pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
17 #include <unordered_set>
18 #include <cassert>
20 #include "test_macros.h"
21 #include "min_allocator.h"
23 int main(int, char**)
26 typedef std::unordered_multiset<int> C;
27 typedef C::const_iterator I;
28 typedef int P;
29 P a[] =
31 P(10),
32 P(20),
33 P(30),
34 P(40),
35 P(50),
36 P(50),
37 P(50),
38 P(60),
39 P(70),
40 P(80)
42 const C c(std::begin(a), std::end(a));
43 std::pair<I, I> r = c.equal_range(30);
44 assert(std::distance(r.first, r.second) == 1);
45 assert(*r.first == 30);
46 r = c.equal_range(5);
47 assert(std::distance(r.first, r.second) == 0);
48 r = c.equal_range(50);
49 assert(std::distance(r.first, r.second) == 3);
50 assert(*r.first == 50);
51 ++r.first;
52 assert(*r.first == 50);
53 ++r.first;
54 assert(*r.first == 50);
56 #if TEST_STD_VER >= 11
58 typedef std::unordered_multiset<int, std::hash<int>,
59 std::equal_to<int>, min_allocator<int>> C;
60 typedef C::const_iterator I;
61 typedef int P;
62 P a[] =
64 P(10),
65 P(20),
66 P(30),
67 P(40),
68 P(50),
69 P(50),
70 P(50),
71 P(60),
72 P(70),
73 P(80)
75 const C c(std::begin(a), std::end(a));
76 std::pair<I, I> r = c.equal_range(30);
77 assert(std::distance(r.first, r.second) == 1);
78 assert(*r.first == 30);
79 r = c.equal_range(5);
80 assert(std::distance(r.first, r.second) == 0);
81 r = c.equal_range(50);
82 assert(std::distance(r.first, r.second) == 3);
83 assert(*r.first == 50);
84 ++r.first;
85 assert(*r.first == 50);
86 ++r.first;
87 assert(*r.first == 50);
89 #endif
91 return 0;