constexpr T* begin() noexcept; // (1) C++20
constexpr const T* begin() const noexcept; // (2) C++20
概要
view
の先頭要素を指すイテレータを取得する。
戻り値
以下と等価:
return data();
例
#include <iostream>
#include <ranges>
int main() {
auto r = std::views::single(1);
int* it = r.begin();
int* last = r.end();
for (; it != last; ++it) {
std::cout << *it << std::endl;
}
}
出力
1
バージョン
言語
- C++20
処理系
- Clang: 13.0.0 ✅
- GCC: 10.1.0 ✅
- ICC: ?
- Visual C++: 2019 Update 10 ✅