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

履歴 編集

function
<ranges>

std::ranges::single_view::begin(C++20)

constexpr T* begin() noexcept;             // (1) C++20
constexpr const T* begin() const noexcept; // (2) C++20

概要

viewの先頭要素を指すイテレータを取得する。

戻り値

以下と等価:

return data();

#include <iostream>
#include <ranges>

int main() {
  auto r = std::views::single(1);
  int* it = r.begin();
  int* last = r.end();

  for (; it != last; ++it) {
    std::cout << *it << std::endl;
  }
}

出力

1

バージョン

言語

  • C++20

処理系