GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • cpprefjp - C++日本語リファレンス
  • GitHub Project

This view

  • Original page
  • New address

GeezerVison is showing cpprefjp.github.io — std::ranges::drop_while_view - cpprefjp C++日本語リファレンス

  1. リファレンス
  2. ranges
  3. drop_while_view

最終更新日時: 2026年09月11日 13時06分31秒 (JST)
Akira Takahashi が更新

履歴 編集

class template
<ranges>

std::ranges::drop_while_view(C++20)

namespace std::ranges {
  template<view V, class Pred>
    requires input_range<V> && is_object_v<Pred> && indirect_unary_predicate<const Pred, iterator_t<V>>
  class drop_while_view : public view_interface<drop_while_view<V, Pred>> { …… }; // (1)

  namespace views {
    inline constexpr /*unspecified*/ drop_while = /*unspecified*/;     // (2)
  }
}

概要

  • (1): 元のRangeの先頭から指定した条件を連続して満たす範囲を除外するview
  • (2): drop_while_viewを生成するRangeアダプタオブジェクト

Rangeコンセプト

borrowed sized output input forward bidirectional random_access contiguous common viewable view
(1) (1) (1) (1) (1) (1) (1) ○ ○
  • (1): Vに従う

テンプレートパラメータ制約

  • view<V>
  • input_range<V>
  • is_object_v<Pred>
  • indirect_unary_predicate<Pred, iterator_t<V>>

効果

  • (2): 式views::drop_while(E, F)の効果はdrop_while_view(E, F)と等しい

メンバ関数

名前 説明 対応バージョン
(constructor) コンストラクタ C++20
base Vの参照を取得する C++20
pred 述語を取得する C++20
begin 先頭を指すイテレータを取得する C++20
end 番兵を取得する C++20

継承しているメンバ関数

名前 説明 対応バージョン
empty Rangeが空かどうかを判定する C++20
operator bool Rangeが空でないかどうかを判定する C++20
data Rangeの先頭へのポインタを取得する C++20
front 先頭要素への参照を取得する C++20
back 末尾要素への参照を取得する C++20
operator[] 要素へアクセスする C++20
cbegin 定数イテレータを取得する C++23
cend 定数イテレータ(番兵)を取得する C++23

推論補助

名前 説明 対応バージョン
(deduction_guide) クラステンプレートの推論補助 C++20

例

#include <ranges>
#include <iostream>

int main() {
  using namespace std;

  for (int i : views::iota(1, 10) | views::drop_while([](int x){ return x < 5; })) {
    cout << i;
  }
}

出力

56789

バージョン

言語

  • C++20

処理系

  • Clang: 13.0.0 ✅
  • GCC: 10.1.0 ✅
  • Visual C++: 2019 Update 10 ✅

参照

  • N4861 24 Ranges library
  • C++20 ranges
  • P2367R0 Remove misuses of list-initialization from Clause 24 (本提案文書はC++20に遡って適用されている)
  • P2017R1 Conditionally borrowed ranges
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.