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// concept checking
12// template<view V, class Pred>
13// requires input_range<V> && is_object_v<Pred> &&
14// indirect_unary_predicate<const Pred, iterator_t<V>>
15// class drop_while_view;
16
17#include <array>
18#include <ranges>
19
20#include "test_iterators.h"
21
22template <class It>
23using Range = std::ranges::subrange<It, sentinel_wrapper<It>>;
24
25template <class Val = int>
26struct Pred {
27 bool operator()(const Val&) const;
28};
29
30template <class V, class Pred>
31concept HasDropWhileView = requires { typename std::ranges::drop_while_view<V, Pred>; };
32
33static_assert(HasDropWhileView<Range<int*>, bool (*)(int)>);
34static_assert(HasDropWhileView<Range<int*>, Pred<int>>);
35
36// !view<V>
37static_assert(!HasDropWhileView<std::array<int, 5>, Pred<int>>);
38
39// !input_range
40static_assert(!HasDropWhileView<Range<cpp20_output_iterator<int*>>, bool (*)(int)>);
41
42// !is_object_v<Pred>
43static_assert(!HasDropWhileView<Range<int*>, Pred<int>&>);
44
45// !indirect_unary_predicate<const Pred, iterator_t<V>>
46static_assert(!HasDropWhileView<Range<int*>, int>);
47static_assert(!HasDropWhileView<Range<int**>, Pred<int>>);
48

source code of libcxx/test/std/ranges/range.adaptors/range.drop.while/range.concept.compile.pass.cpp