std::ranges::lazy_split_view<V,Pattern>::begin
constexpr auto begin(); | (1) | (since C++20) |
constexpr auto begin() const
requires ranges::forward_range<V> &&
ranges::forward_range<const V> &&
ranges::forward_range<const Pattern>;
| (2) | (since C++20) |
Returns an outer_iterator to the first element of the lazy_split_view.
Let base_ be the underlying view and current_ be the underlying caching object (present only if ranges::forward_range<V> is false).
1) Equivalent to
constexpr auto begin()
{
if constexpr (ranges::forward_range<V>)
{
constexpr bool simple = /*simple_view*/<V> && /*simple_view*/<Pattern>;
return /*outer_iterator*/<simple>{*this, ranges::begin(base_)};
}
else
{
current_ = ranges::begin(base_);
return /*outer_iterator*/<false>{*this};
}
}
2) Equivalent to
return /*outer_iterator*/<true>{*this, ranges::begin(base_)};.Return value
outer_iterator to the first element.
Example
Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 3592 | C++20 |
lazy_split_view does not check if Pattern is a simple view |
/*simple_view*/<Pattern> is examined |
| LWG 3599 | C++20 | the const overload (2) is not constrained byranges::forward_range<const Pattern> | constrained |
See also
| returns an iterator or a sentinel to the end (public member function) |
|
|
(C++20) | returns an iterator to the beginning of a range (customization point object) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/ranges/lazy_split_view/begin