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::span::rend - cpprefjp C++日本語リファレンス

  1. リファレンス
  2. span
  3. span
  4. rend

最終更新日時: 2024年06月11日 22時45分38秒 (JST)
Akira Takahashi が更新

履歴 編集

function
<span>

std::span::rend(C++20)

constexpr reverse_iterator rend() const noexcept;

概要

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

戻り値

以下と等価:

return reverse_iterator(begin());

例外

投げない

計算量

定数時間

例

#include <iostream>
#include <span>
#include <vector>
#include <algorithm>

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

  // vの先頭3要素を部分シーケンスとして参照する
  std::span<int> s = std::span(v).first(3);

  // 逆順に出力
  std::for_each(s.rbegin(), s.rend(), [](int x) {
    std::cout << x << std::endl;
  });
}

出力

3
2
1

バージョン

言語

  • C++20

処理系

  • Clang: 9.0 ✅
  • GCC: ??
  • Visual C++: ??
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.