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// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
11
12// template<container-compatible-range<T> R>
13// constexpr iterator insert_range(const_iterator position, R&& rg); // C++23
14
15#include <deque>
16
17#include "../../insert_range_sequence_containers.h"
18#include "test_macros.h"
19
20// Tested cases:
21// - different kinds of insertions (inserting an {empty/one-element/mid-sized/long range} into an
22// {empty/one-element/full} container at the {beginning/middle/end});
23// - inserting move-only elements;
24// - an exception is thrown when copying the elements or when allocating new elements.
25int main(int, char**) {
26 static_assert(test_constraints_insert_range<std::deque, int, double>());
27
28 for_all_iterators_and_allocators<int, const int*>([]<class Iter, class Sent, class Alloc>() {
29 test_sequence_insert_range<std::deque<int, Alloc>, Iter, Sent>([]([[maybe_unused]] auto&& c) {
30 LIBCPP_ASSERT(c.__invariants());
31 });
32 });
33 test_sequence_insert_range_move_only<std::deque>();
34
35 test_insert_range_exception_safety_throwing_copy<std::deque>();
36 test_insert_range_exception_safety_throwing_allocator<std::deque, int>();
37
38 return 0;
39}
40

source code of libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_range.pass.cpp