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 a difference_type, standard-issue, no notes πŸ’…
  • typedef std::forward_iterator_tag iterator_category β€” forward iterator energy, that's her category fr fr
  • typedef std::input_iterator_tag iterator_concept β€” and her concept is input iterator, iykyk
  • typedef const value_type * pointer β€” pointer to a const value_type, keep it const, we don't play
  • typedef 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_results over 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 a regex_iterator, tyvm πŸ’–
  • const value_type & operator* () const noexcept β€” dereferences a regex_iterator
  • regex_iterator & operator++ () β€” increments a regex_iterator
  • regex_iterator operator++ (int) β€” postincrements a regex_iterator, the classic
  • const value_type * operator-> () const noexcept β€” selects a regex_iterator member
  • regex_iterator & operator= (const regex_iterator &)=default β€” copy assigns one regex_iterator to another 🫢
  • bool operator== (const regex_iterator &) const noexcept β€” tests the equivalence of two regex iterators
  • bool operator== (default_sentinel_t) const noexcept β€” and she'll happily compare herself to a default_sentinel_t too, no noexcept drama πŸ’€

🌈 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 the libstdc++ press β€” the header and footer you're used to seeing (that truncated std::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