brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 3154cd3 Raw
40 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2010// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME11 12// template<container-compatible-range<T> R>13//   constexpr void prepend_range(R&& rg); // C++2314 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 (prepending an {empty/one-element/mid-sized/long range} into an22//   {empty/one-element/full} container);23// - prepending 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_prepend_range<std::deque, int, double>());27 28  for_all_iterators_and_allocators<int, const int*>([]<class Iter, class Sent, class Alloc>() {29    test_sequence_prepend_range<std::deque<int, Alloc>, Iter, Sent>([]([[maybe_unused]] auto&& c) {30      LIBCPP_ASSERT(c.__invariants());31    });32  });33  test_sequence_prepend_range_move_only<std::deque>();34 35  test_prepend_range_exception_safety_throwing_copy<std::deque>();36  test_prepend_range_exception_safety_throwing_allocator<std::deque, int>();37 38  return 0;39}40