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

履歴 編集

function
<ranges>

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

constexpr sentinel_t<R> end() const; // (1) C++20

概要

番兵を取得する。

戻り値

メンバ変数r_として保持しているRangeへのポインタがあるとして、以下を返す:

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

int main() {
  std::vector<int> v = {1, 2, 3};
  auto r = std::ranges::ref_view(v);
  auto it = r.begin();
  auto end = r.end();

  while (it != end) {
    std::cout << *it << ' ';
    ++it;
  }
}

出力

1 2 3 

バージョン

言語

  • C++20

処理系