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 // static constexpr bool empty() noexcept;
18 #include "test_macros.h"
22 char buffer
[64] = {10};
26 constexpr void test_empty(T value
) {
27 using SingleView
= std::ranges::single_view
<T
>;
30 std::same_as
<bool> decltype(auto) result
= SingleView::empty();
31 assert(result
== false);
32 static_assert(noexcept(SingleView::empty()));
38 std::same_as
<bool> decltype(auto) result
= std::ranges::empty(sv
);
39 assert(result
== false);
40 static_assert(noexcept(std::ranges::empty(sv
)));
43 const SingleView sv
{value
};
45 std::same_as
<bool> decltype(auto) result
= std::ranges::empty(sv
);
46 assert(result
== false);
47 static_assert(noexcept(std::ranges::empty(std::as_const(sv
))));
51 constexpr bool test() {
53 test_empty
<Empty
>(Empty
{});
54 test_empty
<BigType
>(BigType
{});
59 int main(int, char**) {
61 static_assert(test());