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 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>
20 #include "test_macros.h"
21 #include "min_allocator.h"
26 typedef std::unordered_multiset
<int> C
;
27 typedef C::const_iterator I
;
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);
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);
52 assert(*r
.first
== 50);
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
;
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);
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);
85 assert(*r
.first
== 50);
87 assert(*r
.first
== 50);