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 | // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 |
10 | |
11 | // template<container-compatible-range<value_type> R> |
12 | // unordered_multiset(from_range_t, R&& rg, size_type n = see below, |
13 | // const hasher& hf = hasher(), const key_equal& eql = key_equal(), |
14 | // const allocator_type& a = allocator_type()); // C++23 |
15 | // |
16 | // template<container-compatible-range<value_type> R> |
17 | // unordered_multiset(from_range_t, R&& rg, size_type n, const allocator_type& a) |
18 | // : unordered_multiset(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { } // C++23 |
19 | // |
20 | // template<container-compatible-range<value_type> R> |
21 | // unordered_multiset(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a) |
22 | // : unordered_multiset(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { } // C++23 |
23 | |
24 | #include <array> |
25 | #include <unordered_set> |
26 | |
27 | #include "../../from_range_unordered_containers.h" |
28 | #include "test_macros.h" |
29 | |
30 | void test_duplicates() { |
31 | std::array input = {1, 2, 3, 3, 3, 4, 2, 1, 2}; |
32 | auto c = std::unordered_multiset<int>(std::from_range, input); |
33 | assert(std::ranges::is_permutation(input, c)); |
34 | } |
35 | |
36 | int main(int, char**) { |
37 | for_all_iterators_and_allocators<int>(f: []<class Iter, class Sent, class Alloc>() { |
38 | test_unordered_set<std::unordered_multiset, int, Iter, Sent, test_hash<int>, test_equal_to<int>, Alloc>(); |
39 | }); |
40 | test_unordered_set_move_only<std::unordered_multiset>(); |
41 | |
42 | static_assert(test_set_constraints<std::unordered_set, int, double>()); |
43 | |
44 | test_set_exception_safety_throwing_copy<std::unordered_multiset>(); |
45 | test_set_exception_safety_throwing_allocator<std::unordered_multiset, int>(); |
46 | |
47 | return 0; |
48 | } |
49 | |