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 // template<class R, class Pred>
12 // drop_while_view(R&&, Pred) -> drop_while_view<views::all_t<R>, Pred>;
13
14 #include <cassert>
15 #include <ranges>
16 #include <utility>
17
18 struct Container {
19 int* begin() const;
20 int* end() const;
21 };
22
23 struct View : std::ranges::view_base {
24 int* begin() const;
25 int* end() const;
26 };
27
28 struct Pred {
29 bool operator()(int i) const;
30 };
31
32 bool pred(int);
33
34 static_assert(std::is_same_v<decltype(std::ranges::drop_while_view(Container{}, Pred{})),
35 std::ranges::drop_while_view<std::ranges::owning_view<Container>, Pred>>);
36
37 static_assert(std::is_same_v<decltype(std::ranges::drop_while_view(View{}, pred)), //
38 std::ranges::drop_while_view<View, bool (*)(int)>>);
39
40 static_assert(std::is_same_v<decltype(std::ranges::drop_while_view(View{}, Pred{})), //
41 std::ranges::drop_while_view<View, Pred>>);
42
testRef()43 void testRef() {
44 Container c{};
45 Pred p{};
46 static_assert(std::is_same_v<decltype(std::ranges::drop_while_view(c, p)),
47 std::ranges::drop_while_view<std::ranges::ref_view<Container>, Pred>>);
48 }
49