constexpr auto begin(); // (1) C++20
概要
ストリームから値を1つ読み、それを指すイテレータを取得する。
効果
以下と等価:
*stream_ >> value_;
return iterator{*this};
例
#include <ranges>
#include <sstream>
#include <iostream>
int main() {
auto iss = std::istringstream{"1 2 3 4 5"};
auto r = std::views::istream<int>(iss);
auto it = r.begin();
std::cout << *it << std::endl;
}
出力
1
バージョン
言語
- C++20
処理系
- Clang: 13.0.0 ✅
- GCC: 10.1.0 ✅
- ICC: ?
- Visual C++: 2019 Update 10 ✅