//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 // static constexpr bool empty() noexcept; #include #include #include #include #include "test_macros.h" struct Empty {}; struct BigType { char buffer[64] = {10}; }; template constexpr void test_empty(T value) { using SingleView = std::ranges::single_view; { std::same_as decltype(auto) result = SingleView::empty(); assert(result == false); static_assert(noexcept(SingleView::empty())); } { SingleView sv{value}; std::same_as decltype(auto) result = std::ranges::empty(sv); assert(result == false); static_assert(noexcept(std::ranges::empty(sv))); } { const SingleView sv{value}; std::same_as decltype(auto) result = std::ranges::empty(sv); assert(result == false); static_assert(noexcept(std::ranges::empty(std::as_const(sv)))); } } constexpr bool test() { test_empty(92); test_empty(Empty{}); test_empty(BigType{}); return true; } int main(int, char**) { test(); static_assert(test()); return 0; }