constexpr auto end()
requires (!simple-view<V>); // (1) C++20
constexpr auto end() const
requires range<const V> &&
forward_range<const Pattern>; // (2) C++20
概要
番兵を取得する。
戻り値
- (1), (2) :
split_view
の番兵を返す
例
#include <ranges>
#include <string_view>
#include <iostream>
int main() {
using namespace std::literals;
std::string_view text = "hello,world,split";
std::string_view delimiter = ",";
std::ranges::split_view r{text, delimiter};
auto it = r.begin();
auto end_it = r.end();
while (it != end_it) {
auto subrange = *it;
std::string_view sv{subrange.begin(), subrange.end()};
std::cout << sv << '\n';
++it;
}
}
出力
hello
world
split
バージョン
言語
- C++20
処理系
- Clang: 13.0.0 ✅
- GCC: 10.1.0 ✅
- ICC: ??
- Visual C++: 2019 Update 10 ✅