A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/language/../error/error_code/../../ranges/split_view/begin.html below:

std::ranges::split_view<V,Pattern>::begin - cppreference.com

constexpr /*iterator*/ begin();

(since C++20)

Returns an iterator to the first found subrange.

In order to provide the amortized constant time complexity required by the range concept, this function caches the result within the split_view (by means of cached_begin_ member) for use on subsequent calls.

Let base_ be the underlying data member. Equivalent to:

constexpr /*iterator*/ begin()
{
    if (!cached_begin_.has_value())
        cached_begin_ = this->find_next(ranges::begin(base_));
    return {*this, ranges::begin(base_), cached_begin_.value()};
}
[edit] Return value

An iterator.

[edit] Complexity

Amortized \(\scriptsize \mathcal{O}(1)\)O(1).

[edit] Example

Output:

begin(): "Keep"
Substrings: "Keep" "moving" "forward" ""
begin(): "K"
Letters: K e e p . . m o v i n g . . f o r w a r d . .
[edit] See also returns an iterator or a sentinel to the end
(public member function) [edit] returns an iterator to the beginning
(public member function of std::ranges::lazy_split_view<V,Pattern>) [edit] returns an iterator to the beginning of a range
(customization point object)[edit]

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4