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// Some fields in the test case variables are deliberately not explicitly initialized, this silences a warning on GCC.
11// ADDITIONAL_COMPILE_FLAGS(gcc-style-warnings): -Wno-missing-field-initializers
12
13// <unordered_map>
14
15// template<container-compatible-range<value_type> R>
16// void insert_range(R&& rg); // C++23
17
18#include <unordered_map>
19
20#include "../../../insert_range_maps_sets.h"
21#include "test_macros.h"
22
23int main(int, char**) {
24 // Note: we want to use a pair with non-const elements for input (an assignable type is a lot more convenient) but
25 // have to use the exact `value_type` of the map (that is, `pair<const K, V>`) for the allocator.
26 using Pair = std::pair<int, char>;
27 using ConstPair = std::pair<const int, char>;
28 for_all_iterators_and_allocators<ConstPair, const Pair*>([]<class Iter, class Sent, class Alloc>() {
29 test_map_set_insert_range<std::unordered_multimap<int, char, test_hash<int>, test_equal_to<int>, Alloc>, Pair, Iter, Sent>(/*allow_duplicates=*/true);
30 });
31
32 static_assert(test_map_constraints_insert_range<std::unordered_multimap, int, int, char, double>());
33
34 test_map_insert_range_move_only<std::unordered_multimap>();
35
36 test_map_insert_range_exception_safety_throwing_copy<std::unordered_multimap>();
37 test_unord_map_insert_range_exception_safety_throwing_allocator<std::unordered_multimap, int, int>();
38
39 return 0;
40}
41
42

source code of libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp