1//===----------------------------------------------------------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9// UNSUPPORTED: c++03, c++11, c++14, c++17
10
11// <span>
12
13// template<class ElementType, size_t Extent>
14// inline constexpr bool ranges::enable_borrowed_range<
15// span<ElementType, Extent>> = true;
16
17#include <span>
18
19#include "test_macros.h"
20
21void test() {
22 static_assert(std::ranges::enable_borrowed_range<std::span<int, 0> >);
23 static_assert(std::ranges::enable_borrowed_range<std::span<int, 42> >);
24 static_assert(std::ranges::enable_borrowed_range<std::span<int, std::dynamic_extent> >);
25 static_assert(!std::ranges::enable_borrowed_range<std::span<int, 42>&>);
26 static_assert(!std::ranges::enable_borrowed_range<std::span<int, 42> const>);
27}
28

source code of libcxx/test/std/containers/views/views.span/enable_borrowed_range.compile.pass.cpp