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 | // void clear() noexcept; |
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 | { |
26 | typedef std::unordered_multiset<int> C; |
27 | typedef int P; |
28 | P a[] = |
29 | { |
30 | P(1), |
31 | P(2), |
32 | P(3), |
33 | P(4), |
34 | P(1), |
35 | P(2) |
36 | }; |
37 | C c(a, a + sizeof(a)/sizeof(a[0])); |
38 | ASSERT_NOEXCEPT(c.clear()); |
39 | c.clear(); |
40 | assert(c.size() == 0); |
41 | } |
42 | #if TEST_STD_VER >= 11 |
43 | { |
44 | typedef std::unordered_multiset<int, std::hash<int>, |
45 | std::equal_to<int>, min_allocator<int>> C; |
46 | typedef int P; |
47 | P a[] = |
48 | { |
49 | P(1), |
50 | P(2), |
51 | P(3), |
52 | P(4), |
53 | P(1), |
54 | P(2) |
55 | }; |
56 | C c(a, a + sizeof(a)/sizeof(a[0])); |
57 | ASSERT_NOEXCEPT(c.clear()); |
58 | c.clear(); |
59 | assert(c.size() == 0); |
60 | } |
61 | #endif |
62 | |
63 | return 0; |
64 | } |
65 | |