constexpr sentinel_t<R> end() const; // (1) C++20
概要
番兵を取得する。
戻り値
メンバ変数r_
として保持しているRangeへのポインタがあるとして、以下を返す:
ranges::end(*r_);
例
#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
処理系
- Clang: 13.0.0 ✅
- GCC: 10.1.0 ✅
- ICC: ?
- Visual C++: 2019 Update 10 ✅