brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · d148fd6 Raw
49 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 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 18struct Container {19  int* begin() const;20  int* end() const;21};22 23struct View : std::ranges::view_base {24  int* begin() const;25  int* end() const;26};27 28struct Pred {29  bool operator()(int i) const;30};31 32bool pred(int);33 34static_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 37static_assert(std::is_same_v<decltype(std::ranges::drop_while_view(View{}, pred)), //38                             std::ranges::drop_while_view<View, bool (*)(int)>>);39 40static_assert(std::is_same_v<decltype(std::ranges::drop_while_view(View{}, Pred{})), //41                             std::ranges::drop_while_view<View, Pred>>);42 43void 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