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

履歴 編集

function
<ranges>

std::ranges::stride_view::stride(C++23)

constexpr range_difference_t<V> stride() const noexcept; // (1) C++23

概要

メンバ変数として保持している、歩幅を取得する。

効果

  • (1) : return stride_;

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

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

  std::ranges::stride_view sv{v, 3};

  // 歩幅を取得
  std::cout << "stride: " << sv.stride() << std::endl;
}

出力

stride: 3

バージョン

言語

  • C++23

処理系

参照