std::regex_...rator++(int)(3)
π std::regex_...rator++(int)(3) π
okay so this page is from the C++ Standard Libary manual β yes, that spelling is literally on the page, bestie β and it's all about std::regex_iterator::operator++ and operator++(int). It's giving "advance the iterator to the next match" energy. β¨
π NAME π
std::regex_iterator::operator++,operator++(int) β std::regex_iterator::operator++,operator++(int)
Yes, it says it twice. Iconic, honestly.
β¨ Synopsis β¨
regex_iterator& operator++(); (since C++11)
regex_iterator operator++( int ); (since C++11)
Advances the iterator on the next match.
π§ This section is incomplete Reason: explain better
okay so here's how the whole "next match" thing goes down. At first, a local variable of type BidirIt is constructed with the value of match[0].second.
If the iterator holds a zero-length match and start == end, then *this is set to the end-of-sequence iterator and the function returns.
Otherwise, if the iterator holds a zero-length match, the operator invokes the following:
regex_search(start, end, match, *pregex,
flags | regex_constants::match_not_null |
regex_constants::match_continuous);
If the call returns true, the function returns.
Otherwise, the operator increments start and continues as if the most recent match was not a zero-length match.
If the most recent match was not a zero-length match, the operator sets flags to flags | regex_constants::match_prev_avail and invokes the following:
regex_search(start, end, match, *pregex, flags);
If the call returns false, the iterator sets *this to the end-of-sequence iterator, and the function returns.
In all cases in which the call to regex_search returns true, match.prefix().first will be equal to the previous value of match[0].second, and for each index i in the range [0, match.size()) for which match[i].matched is true, match[i].position() will return distance(begin, match[i].first).
This means that match[i].position() gives the offset from the beginning of the target sequence, which is often not the same as the offset from the sequence passed in the call to regex_search.
It is unspecified how the implementation makes these adjustments. This means that a compiler may call an implementation-specific search function, in which case a user-defined specialization of regex_search will not be called.
β οΈ The behavior is undefined if the iterator is an end-of-sequence iterator. Do not do that, bestie. π
πΈ Parameters πΈ
(none) β literally no parameters. Clean. Minimalist. We love to see it. π«Ά
π Return value π
*this- The previous value of the iterator.
π·οΈ Category π·οΈ
Todo with reason
big sparkly sign-off energy: this cutie came from source/version http://cppreference.com, dated 2024.06.10 π
β¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms