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 | |
11 | // template<container-compatible-range<T> R> |
12 | // vector(from_range_t, R&& rg, const Allocator& = Allocator()); // C++23 |
13 | |
14 | #include <vector> |
15 | |
16 | #include "../../from_range_sequence_containers.h" |
17 | #include "asan_testing.h" |
18 | #include "test_macros.h" |
19 | |
20 | constexpr bool test() { |
21 | for_all_iterators_and_allocators<int>(f: []<class Iter, class Sent, class Alloc>() { |
22 | test_sequence_container<std::vector, int, Iter, Sent, Alloc>([]([[maybe_unused]] const auto& c) { |
23 | LIBCPP_ASSERT(c.__invariants()); |
24 | LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); |
25 | }); |
26 | }); |
27 | test_sequence_container_move_only<std::vector>(); |
28 | |
29 | return true; |
30 | } |
31 | |
32 | int main(int, char**) { |
33 | static_assert(test_constraints<std::vector, int, double>()); |
34 | test(); |
35 | |
36 | static_assert(test()); |
37 | |
38 | test_exception_safety_throwing_copy<std::vector>(); |
39 | test_exception_safety_throwing_allocator<std::vector, int>(); |
40 | |
41 | return 0; |
42 | } |
43 | |