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 | //===----------------------------------------------------------------------===// |
8 | |
9 | // <unordered_set> |
10 | |
11 | // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, |
12 | // class Alloc = allocator<Value>> |
13 | // class unordered_multiset |
14 | |
15 | // iterator find(const key_type& k); |
16 | |
17 | #include <unordered_set> |
18 | #include <cassert> |
19 | |
20 | #include "test_macros.h" |
21 | #include "min_allocator.h" |
22 | |
23 | int main(int, char**) { |
24 | { |
25 | typedef std::unordered_multiset<int> C; |
26 | typedef int P; |
27 | P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)}; |
28 | C c(std::begin(arr&: a), std::end(arr&: a)); |
29 | C::iterator i = c.find(x: 30); |
30 | assert(*i == 30); |
31 | i = c.find(x: 5); |
32 | assert(i == c.cend()); |
33 | } |
34 | #if TEST_STD_VER >= 11 |
35 | { |
36 | typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C; |
37 | typedef int P; |
38 | P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)}; |
39 | C c(std::begin(a), std::end(a)); |
40 | C::iterator i = c.find(30); |
41 | assert(*i == 30); |
42 | i = c.find(5); |
43 | assert(i == c.cend()); |
44 | } |
45 | #endif |
46 | |
47 | return 0; |
48 | } |
49 | |