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 void append_range(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 (appending an {empty/one-element/mid-sized/long range} into an |
22 | // {empty/one-element/full} container); |
23 | // - appending move-only elements; |
24 | // - an exception is thrown when copying the elements or when allocating new elements. |
25 | int main(int, char**) { |
26 | static_assert(test_constraints_append_range<std::deque, int, double>()); |
27 | |
28 | for_all_iterators_and_allocators<int, const int*>([]<class Iter, class Sent, class Alloc>() { |
29 | test_sequence_append_range<std::deque<int, Alloc>, Iter, Sent>([]([[maybe_unused]] auto&& c) { |
30 | LIBCPP_ASSERT(c.__invariants()); |
31 | }); |
32 | }); |
33 | test_sequence_append_range_move_only<std::deque>(); |
34 | |
35 | test_append_range_exception_safety_throwing_copy<std::deque>(); |
36 | test_append_range_exception_safety_throwing_allocator<std::deque, int>(); |
37 | |
38 | return 0; |
39 | } |
40 | |