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 | // template <class InputIterator> |
16 | // void insert(InputIterator first, InputIterator last); |
17 | |
18 | #include <unordered_set> |
19 | #include <cassert> |
20 | |
21 | #include "test_macros.h" |
22 | #include "test_iterators.h" |
23 | #include "min_allocator.h" |
24 | |
25 | int main(int, char**) { |
26 | { |
27 | typedef std::unordered_multiset<int> C; |
28 | typedef int P; |
29 | P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)}; |
30 | C c; |
31 | c.insert(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0]))); |
32 | assert(c.size() == 6); |
33 | assert(c.count(1) == 2); |
34 | assert(c.count(2) == 2); |
35 | assert(c.count(3) == 1); |
36 | assert(c.count(4) == 1); |
37 | } |
38 | #if TEST_STD_VER >= 11 |
39 | { |
40 | typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C; |
41 | typedef int P; |
42 | P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)}; |
43 | C c; |
44 | c.insert(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0]))); |
45 | assert(c.size() == 6); |
46 | assert(c.count(1) == 2); |
47 | assert(c.count(2) == 2); |
48 | assert(c.count(3) == 1); |
49 | assert(c.count(4) == 1); |
50 | } |
51 | #endif |
52 | |
53 | return 0; |
54 | } |
55 | |