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

source code of libcxx/test/std/containers/sequences/vector.bool/construct_from_range.pass.cpp