最終更新日時(UTC):
が更新

履歴 編集

function
<ranges>

std::ranges::lazy_split_view::end(C++20)

constexpr auto end()
  requires (!simple-view<V>);       // (1) C++20

constexpr auto end() const
  requires range<const V> &&
           forward_range<const Pattern>;  // (2) C++20

概要

番兵を取得する。

戻り値

  • (1), (2) : lazy_split_viewの番兵を返す

#include <ranges>
#include <vector>
#include <iostream>

int main() {
  std::vector<int> v = {1, 2, 3, 4, 5, 6, 7, 8, 9};
  std::vector<int> pattern = {4, 5};

  std::ranges::lazy_split_view r{v, pattern};

  auto it = r.begin();
  auto end_it = r.end();
  while (it != end_it) {
    auto subrange = *it;
    for (int n : subrange) {
      std::cout << n;
    }
    std::cout << '\n';
    ++it;
  }
}

出力

123
6789

バージョン

言語

  • C++20

処理系