143377cc4Svarconst //===----------------------------------------------------------------------===//
243377cc4Svarconst //
343377cc4Svarconst // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
443377cc4Svarconst // See https://llvm.org/LICENSE.txt for license information.
543377cc4Svarconst // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
643377cc4Svarconst //
743377cc4Svarconst //===----------------------------------------------------------------------===//
843377cc4Svarconst
943377cc4Svarconst // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
1043377cc4Svarconst
1143377cc4Svarconst // template<container-compatible-range<T> R>
1243377cc4Svarconst // constexpr void assign_range(R&& rg); // C++23
1343377cc4Svarconst
1443377cc4Svarconst #include <deque>
1543377cc4Svarconst
1643377cc4Svarconst #include "../../insert_range_sequence_containers.h"
1743377cc4Svarconst #include "test_macros.h"
1843377cc4Svarconst
1943377cc4Svarconst // Tested cases:
2043377cc4Svarconst // - different kinds of assignments (assigning an {empty/one-element/mid-sized/long range} to an
2143377cc4Svarconst // {empty/one-element/full} container);
2243377cc4Svarconst // - assigning move-only elements;
2343377cc4Svarconst // - an exception is thrown when copying the elements or when allocating new elements.
main(int,char **)2443377cc4Svarconst int main(int, char**) {
2543377cc4Svarconst static_assert(test_constraints_assign_range<std::deque, int, double>());
2643377cc4Svarconst
2743377cc4Svarconst for_all_iterators_and_allocators<int, const int*>([]<class Iter, class Sent, class Alloc>() {
28*346a2990SStephan T. Lavavej test_sequence_assign_range<std::deque<int, Alloc>, Iter, Sent>([]([[maybe_unused]] auto&& c) {
2943377cc4Svarconst LIBCPP_ASSERT(c.__invariants());
3043377cc4Svarconst });
3143377cc4Svarconst });
3243377cc4Svarconst test_sequence_assign_range_move_only<std::deque>();
3343377cc4Svarconst
3443377cc4Svarconst test_assign_range_exception_safety_throwing_copy<std::deque>();
3543377cc4Svarconst test_assign_range_exception_safety_throwing_allocator<std::deque, int>();
3643377cc4Svarconst
3743377cc4Svarconst return 0;
3843377cc4Svarconst }
39