36 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++14, c++1710//11// template<class T, class Pred>12// inline constexpr bool enable_borrowed_range<drop_while_view<T, Pred>> =13// enable_borrowed_range<T>;14 15#include <ranges>16 17struct NonBorrowed : std::ranges::view_base {18 int* begin();19 int* end();20};21 22struct Borrowed : std::ranges::view_base {23 int* begin();24 int* end();25};26 27struct Pred {28 bool operator()(int) const;29};30 31template <>32inline constexpr bool std::ranges::enable_borrowed_range<Borrowed> = true;33 34static_assert(!std::ranges::borrowed_range<std::ranges::drop_while_view<NonBorrowed, Pred>>);35static_assert(std::ranges::borrowed_range<std::ranges::drop_while_view<Borrowed, Pred>>);36