std::ranges::chunk_by_view<V,Pred>::begin

From cppreference.com
 
 
Ranges library
Range access
Range conversions
(C++23)
Range primitives



Dangling iterator handling
Range concepts
Views

Range factories
Range adaptors
Range generators
Range adaptor objects
Range adaptor closure objects
Helper items
(until C++23)(C++23)


 
 
constexpr __iterator begin();
(since C++23)

Returns an iterator to the first element of the chunk_by_view.

Equivalent to:

ranges::iterator_t<V> iter;
 
if (begin_.has_value())
    iter = begin_.value();
else
{
    iter = __find_next(ranges::begin(base()));
    begin_ = iter; // caching
}
 
return __iterator(*this, ranges::begin(base()), iter);

The behavior is undefined if the underlying predicate pred_ does not contain a value.

Parameters

(none)

Return value

Iterator to the first element.

Notes

In order to provide the amortized constant-time complexity required by the range concept, this function caches the result within the data member begin_ (the name is for exposition only) for use on subsequent calls.

Example

See also

(C++23)
returns an iterator or a sentinel to the end
(public member function)
returns an iterator to the beginning of a range
(customization point object)