// -*- C++ -*- //===------------------------------ span ---------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 // // constexpr bool empty() const noexcept; // #include #include #include #include "test_macros.h" struct A{}; constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; int main () { static_assert( noexcept(std::span ().empty()), ""); static_assert( noexcept(std::span().empty()), ""); static_assert( std::span().empty(), ""); static_assert( std::span().empty(), ""); static_assert( std::span().empty(), ""); static_assert( std::span().empty(), ""); static_assert( std::span().empty(), ""); static_assert( std::span().empty(), ""); static_assert( std::span().empty(), ""); static_assert( std::span().empty(), ""); static_assert( std::span().empty(), ""); static_assert( std::span().empty(), ""); static_assert(!std::span(iArr1, 1).empty(), ""); static_assert(!std::span(iArr1, 2).empty(), ""); static_assert(!std::span(iArr1, 3).empty(), ""); static_assert(!std::span(iArr1, 4).empty(), ""); static_assert(!std::span(iArr1, 5).empty(), ""); assert( (std::span().empty() )); assert( (std::span().empty() )); assert( (std::span().empty() )); assert( (std::span().empty() )); assert( (std::span().empty() )); assert( (std::span().empty() )); assert( (std::span().empty() )); assert( (std::span().empty() )); assert( (std::span().empty() )); assert( (std::span().empty())); assert(!(std::span(iArr2, 1).empty())); assert(!(std::span(iArr2, 2).empty())); assert(!(std::span(iArr2, 3).empty())); assert(!(std::span(iArr2, 4).empty())); assert(!(std::span(iArr2, 5).empty())); std::string s; assert( ((std::span(&s, (std::ptrdiff_t) 0)).empty())); assert(!((std::span(&s, 1).empty()))); }