1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
11 // single_view() requires default_initializable<T> = default;
16 #include "test_macros.h"
18 struct BigType
{ char buffer
[64] = {10}; };
20 template<bool DefaultCtorEnabled
>
21 struct IsDefaultConstructible
{
22 IsDefaultConstructible() requires DefaultCtorEnabled
= default;
25 constexpr bool test() {
26 static_assert( std::default_initializable
<std::ranges::single_view
<IsDefaultConstructible
<true>>>);
27 static_assert(!std::default_initializable
<std::ranges::single_view
<IsDefaultConstructible
<false>>>);
30 std::ranges::single_view
<BigType
> sv
;
31 assert(sv
.data()->buffer
[0] == 10);
32 assert(sv
.size() == 1);
35 const std::ranges::single_view
<BigType
> sv
;
36 assert(sv
.data()->buffer
[0] == 10);
37 assert(sv
.size() == 1);
43 int main(int, char**) {
45 static_assert(test());