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 // constexpr explicit single_view(const T& t);
12 // constexpr explicit single_view(T&& t);
18 #include "test_macros.h"
21 struct BigType
{ char buffer
[64] = {10}; };
23 constexpr bool test() {
26 std::ranges::single_view
<BigType
> sv(bt
);
27 assert(sv
.data()->buffer
[0] == 10);
28 assert(sv
.size() == 1);
32 const std::ranges::single_view
<BigType
> sv(bt
);
33 assert(sv
.data()->buffer
[0] == 10);
34 assert(sv
.size() == 1);
39 std::ranges::single_view
<BigType
> sv(std::move(bt
));
40 assert(sv
.data()->buffer
[0] == 10);
41 assert(sv
.size() == 1);
45 const std::ranges::single_view
<BigType
> sv(std::move(bt
));
46 assert(sv
.data()->buffer
[0] == 10);
47 assert(sv
.size() == 1);
53 int main(int, char**) {
55 static_assert(test());