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// list(from_range_t, R&& rg, const Allocator& = Allocator()); // C++23; constexpr since C++26
13
14#include <list>
15#include <type_traits>
16
17#include "../../from_range_sequence_containers.h"
18#include "test_macros.h"
19
20TEST_CONSTEXPR_CXX26 bool test() {
21 for_all_iterators_and_allocators<int>([]<class Iter, class Sent, class Alloc>() {
22 test_sequence_container<std::list, int, Iter, Sent, Alloc>([](const auto&) {
23 // No additional validation to do.
24 });
25 });
26 test_sequence_container_move_only<std::list>();
27
28 static_assert(test_constraints<std::list, int, double>());
29
30 if (!TEST_IS_CONSTANT_EVALUATED) {
31 test_exception_safety_throwing_copy<std::list>();
32 test_exception_safety_throwing_allocator<std::list, int>();
33 }
34
35 return true;
36}
37
38int main(int, char**) {
39 assert(test());
40#if TEST_STD_VER >= 26
41 static_assert(test());
42#endif
43
44 return 0;
45}
46

source code of libcxx/test/std/containers/sequences/list/list.cons/from_range.pass.cpp