STD::REGEX_ITERATOR(3cxx)
β¨ std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits > β¨
okay bestie, welcome to the 3cxx manual page for the one and only std::regex_iterator β she's a libstdc++ icon, she's a template, and she's literally about to make your whole regex life easier. sit down, grab a strawberry π, let's go.
πΈ SYNOPSIS πΈ
#include <regex>
π¦ Public Types
typedef std::ptrdiff_t difference_typeβ yep, she's got adifference_type, standard-issue, no notes πtypedef std::forward_iterator_tag iterator_categoryβ forward iterator energy, that's her category fr frtypedef std::input_iterator_tag iterator_conceptβ and her concept is input iterator, iykyktypedef const value_type * pointerβ pointer to aconst value_type, keep it const, we don't playtypedef const value_type & referenceβ same vibe but a reference π«Άtypedef basic_regex< _Ch_type, _Rx_traits > regex_typeβ this is the regex type she matches with β¨typedef match_results< _Bi_iter > value_typeβ and this is what you actually get out of her:match_resultsover your iterator π
π§ Public Member Functions
regex_iterator ()=defaultβ gives you a singular iterator, which is the whole vibe for saying "one-past-the-end of a range". iconic sentinel behaviour πregex_iterator (_Bi_iter __a, _Bi_iter __b, const regex_type &__re, regex_constants::match_flag_type __m=regex_constants::match_default)β the main character constructor π¬regex_iterator (_Bi_iter, _Bi_iter, const regex_type &&, regex_constants::match_flag_type=regex_constants::match_default)=deleteβ nope. the rvalue-regex overload is=deleted, do not come for her with a temporary, she will not accept it πregex_iterator (const regex_iterator &)=defaultβ copy constructs aregex_iterator, tyvm πconst value_type & operator* () const noexceptβ dereferences aregex_iteratorregex_iterator & operator++ ()β increments aregex_iteratorregex_iterator operator++ (int)β postincrements aregex_iterator, the classicconst value_type * operator-> () const noexceptβ selects aregex_iteratormemberregex_iterator & operator= (const regex_iterator &)=defaultβ copy assigns oneregex_iteratorto another π«Άbool operator== (const regex_iterator &) const noexceptβ tests the equivalence of two regex iteratorsbool operator== (default_sentinel_t) const noexceptβ and she'll happily compare herself to adefault_sentinel_ttoo, nonoexceptdrama π
π Detailed Description
template<typename _Bi_iter, typename _Ch_type = typename
iterator_traits<_Bi_iter>::value_type, typename _Rx_traits =
regex_traits<_Ch_type>>
class std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >
bestie. she is literally "an iterator adaptor that will provide repeated calls of regex_search over a range until no more matches remain." that's it, that's the whole personality β she just keeps handing you matches until the range runs dry π₯
Since: C++11 (she's been that girl since C++11, periodt)
π Constructor & Destructor Documentation π
π regex_iterator () [default]
template<typename _Bi_iter , typename _Ch_type = typename
iterator_traits<_Bi_iter>::value_type, typename _Rx_traits =
regex_traits<_Ch_type>>
std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::regex_iterator () [default]
Provides a singular iterator, useful for indicating one-past-the-end of a range. that's her whole job here and she does it flawlessly β¨
Referenced by std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::regex_iterator(). (yes she references herself, main character energy, we been knew π)
π regex_iterator (_Bi_iter __a, _Bi_iter __b, const regex_type & __re, regex_constants::match_flag_type __m = regex_constants::match_default) [inline]
template<typename _Bi_iter , typename _Ch_type = typename
iterator_traits<_Bi_iter>::value_type, typename _Rx_traits =
regex_traits<_Ch_type>>
std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::regex_iterator (_Bi_iter __a, _Bi_iter __b, const
regex_type & __re, regex_constants::match_flag_type __m =
regex_constants::match_default) [inline]
"Constructs a regex_iterator..." β the three dots are in the original bestie, I'm not hiding anything from you π
πΈ Parameters
__a[IN]β the start of a text range to search__b[IN]β one-past-the-end of the text range to search (yes the past-the-end thing again, it's a whole theme)__re[IN]β the regular expression to match__m[IN]β policy flags for match rules
References: std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::regex_iterator(), and std::regex_search().
π¦ regex_iterator (const regex_iterator< _Bi_iter, _Ch_type, _Rx_traits > &) [default]
template<typename _Bi_iter , typename _Ch_type = typename
iterator_traits<_Bi_iter>::value_type, typename _Rx_traits =
regex_traits<_Ch_type>>
std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::regex_iterator (const regex_iterator< _Bi_iter, _Ch_type,
_Rx_traits > &) [default]
Copy constructs a regex_iterator. simple, clean, slay π
β Member Function Documentation β
π const value_type & operator* () const [inline], [noexcept]
template<typename _Bi_iter , typename _Ch_type = typename
iterator_traits<_Bi_iter>::value_type, typename _Rx_traits =
regex_traits<_Ch_type>>
const value_type & std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::operator* () const [inline],
[noexcept]
Dereferences a regex_iterator. she's noexcept about it too π«Ά
π₯ regex_iterator & operator++ ()
template<typename _Bi_iter , typename _Ch_type , typename _Rx_traits >
regex_iterator< _Bi_iter, _Ch_type, _Rx_traits > & std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::operator++ ()
Increments a regex_iterator. the pre-increment one, the good one β¨
References: std::regex_constants::match_continuous, std::regex_constants::match_not_null, std::regex_constants::match_prev_avail, and std::regex_search(). she is lowkey juggling all of those flags for you, say thank you π€
π regex_iterator operator++ (int) [inline]
template<typename _Bi_iter , typename _Ch_type = typename
iterator_traits<_Bi_iter>::value_type, typename _Rx_traits =
regex_traits<_Ch_type>>
regex_iterator std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::operator++ (int) [inline]
Postincrements a regex_iterator. you get a copy, she moves on, classic post-increment behaviour π
π§ const value_type * operator-> () const [inline], [noexcept]
template<typename _Bi_iter , typename _Ch_type = typename
iterator_traits<_Bi_iter>::value_type, typename _Rx_traits =
regex_traits<_Ch_type>>
const value_type * std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::operator-> () const [inline],
[noexcept]
Selects a regex_iterator member. arrow go brrr β
π regex_iterator & operator= (const regex_iterator< _Bi_iter, _Ch_type, _Rx_traits > &) [default]
template<typename _Bi_iter , typename _Ch_type = typename
iterator_traits<_Bi_iter>::value_type, typename _Rx_traits =
regex_traits<_Ch_type>>
regex_iterator & std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::operator= (const regex_iterator< _Bi_iter,
_Ch_type, _Rx_traits > &) [default]
Copy assigns one regex_iterator to another. defaulted, obviously, she's not doing extra work for free π
πΈ bool operator== (const regex_iterator< _Bi_iter, _Ch_type, _Rx_traits > & __rhs) const [noexcept]
template<typename _Bi_iter , typename _Ch_type , typename _Rx_traits > bool
std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::operator== (const regex_iterator< _Bi_iter, _Ch_type,
_Rx_traits > & __rhs) const [noexcept]
Tests the equivalence of two regex iterators. that's __rhs right there, the right-hand side, she named it and everything π«Ά
π Author π
Generated automatically by Doxygen for libstdc++ from the source code. so like, a robot wrote her bio, but the robot ate, ngl π€β¨
heads up bestie: this page came off thelibstdc++press β the header and footer you're used to seeing (that truncatedstd::regex_ite...e, _Rx_traits >(3cxx)situation, on repeat) are just the man-page furniture, and the author credit above is the Doxygen-generated one from the source code. no date on this one, the footer's just the source and that mangled title. π
okay that's the whole page, you're officially a regex_iterator girlie now. go forth and repeatedly regex_search, ily, bye ππ¦π
π¦ where this page comes from
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms