REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
Loading...
Searching...
No Matches
real::compat::regex_iterator< BidirIt, CharT, Traits > Class Template Reference

Iterates the non-overlapping matches of a pattern in a sequence (std::regex_iterator). More...

#include <regex_iter.hpp>

Collaboration diagram for real::compat::regex_iterator< BidirIt, CharT, Traits >:
[legend]

Public Types

using value_type = match_results< BidirIt >
 Yielded match.
 
using difference_type = std::ptrdiff_t
 Iterator traits.
 
using pointer = const value_type *
 Arrow type.
 
using reference = const value_type &
 Dereference type.
 
using iterator_category = std::forward_iterator_tag
 std::regex_iterator parity.
 
using regex_type = basic_regex< CharT, Traits >
 The pattern type.
 

Public Member Functions

 regex_iterator ()=default
 Constructs the end sentinel.
 
 regex_iterator (BidirIt first, BidirIt last, const regex_type &re, regex_constants::match_flag_type flags=regex_constants::match_default)
 Constructs a begin iterator over [first, last) and finds the first match. A constraining match flag (see detail::real_honors) routes to the std backend, which carries the flags through the wrapped std::regex_iterator.
 
 regex_iterator (BidirIt first, BidirIt last, const regex_type &&re, regex_constants::match_flag_type flags=regex_constants::match_default)=delete
 Constructing from a temporary regex would dangle (std::regex_iterator parity).
 
reference operator* () const
 
pointer operator-> () const
 
regex_iteratoroperator++ ()
 
regex_iterator operator++ (int)
 
bool operator== (const regex_iterator &other) const
 
bool operator!= (const regex_iterator &other) const
 

Private Member Functions

void next_real ()
 Advances the real path: next region search from real_pos_.
 
void sync_std ()
 Syncs the std path from the wrapped std::regex_iterator.
 

Private Attributes

BidirIt begin_ {}
 
BidirIt end_ {}
 
const regex_typere_ {nullptr}
 
regex_constants::match_flag_type flags_ {regex_constants::match_default}
 
bool real_path_ {false}
 
std::size_t real_pos_ {}
 
std::optional< std::regex_iterator< BidirIt > > std_it_
 
value_type match_
 
bool at_end_ {true}
 

Detailed Description

template<typename BidirIt, typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
class real::compat::regex_iterator< BidirIt, CharT, Traits >

Iterates the non-overlapping matches of a pattern in a sequence (std::regex_iterator).

Same per-operation routing as regex_replace — a real-backed, non-nullable pattern drives real's linear traversal (repeated region search — a non-nullable pattern never matches empty, so the position always advances past the match and the ECMAScript and real sequences agree); the std backend and nullable patterns wrap std::regex_iterator (whose empty-match advance is ECMAScript's). The default-constructed iterator is the end sentinel.

Template Parameters
BidirItA contiguous iterator into the searched sequence.

Definition at line 31 of file regex_iter.hpp.

Member Typedef Documentation

◆ difference_type

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
using real::compat::regex_iterator< BidirIt, CharT, Traits >::difference_type = std::ptrdiff_t

Iterator traits.

Definition at line 36 of file regex_iter.hpp.

◆ iterator_category

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
using real::compat::regex_iterator< BidirIt, CharT, Traits >::iterator_category = std::forward_iterator_tag

std::regex_iterator parity.

Definition at line 39 of file regex_iter.hpp.

◆ pointer

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
using real::compat::regex_iterator< BidirIt, CharT, Traits >::pointer = const value_type*

Arrow type.

Definition at line 37 of file regex_iter.hpp.

◆ reference

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
using real::compat::regex_iterator< BidirIt, CharT, Traits >::reference = const value_type&

Dereference type.

Definition at line 38 of file regex_iter.hpp.

◆ regex_type

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
using real::compat::regex_iterator< BidirIt, CharT, Traits >::regex_type = basic_regex<CharT, Traits>

The pattern type.

Definition at line 40 of file regex_iter.hpp.

◆ value_type

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
using real::compat::regex_iterator< BidirIt, CharT, Traits >::value_type = match_results<BidirIt>

Yielded match.

Definition at line 35 of file regex_iter.hpp.

Constructor & Destructor Documentation

◆ regex_iterator() [1/3]

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
real::compat::regex_iterator< BidirIt, CharT, Traits >::regex_iterator ( )
default

Constructs the end sentinel.

◆ regex_iterator() [2/3]

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
real::compat::regex_iterator< BidirIt, CharT, Traits >::regex_iterator ( BidirIt  first,
BidirIt  last,
const regex_type re,
regex_constants::match_flag_type  flags = regex_constants::match_default 
)
inline

Constructs a begin iterator over [first, last) and finds the first match. A constraining match flag (see detail::real_honors) routes to the std backend, which carries the flags through the wrapped std::regex_iterator.

Definition at line 48 of file regex_iter.hpp.

◆ regex_iterator() [3/3]

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
real::compat::regex_iterator< BidirIt, CharT, Traits >::regex_iterator ( BidirIt  first,
BidirIt  last,
const regex_type &&  re,
regex_constants::match_flag_type  flags = regex_constants::match_default 
)
delete

Constructing from a temporary regex would dangle (std::regex_iterator parity).

Member Function Documentation

◆ next_real()

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
void real::compat::regex_iterator< BidirIt, CharT, Traits >::next_real ( )
inlineprivate

Advances the real path: next region search from real_pos_.

Definition at line 138 of file regex_iter.hpp.

◆ operator!=()

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
bool real::compat::regex_iterator< BidirIt, CharT, Traits >::operator!= ( const regex_iterator< BidirIt, CharT, Traits > &  other) const
inline

Definition at line 120 of file regex_iter.hpp.

◆ operator*()

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
reference real::compat::regex_iterator< BidirIt, CharT, Traits >::operator* ( ) const
inline

Definition at line 73 of file regex_iter.hpp.

◆ operator++() [1/2]

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
regex_iterator & real::compat::regex_iterator< BidirIt, CharT, Traits >::operator++ ( )
inline

Definition at line 83 of file regex_iter.hpp.

◆ operator++() [2/2]

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
regex_iterator real::compat::regex_iterator< BidirIt, CharT, Traits >::operator++ ( int  )
inline

Definition at line 101 of file regex_iter.hpp.

◆ operator->()

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
pointer real::compat::regex_iterator< BidirIt, CharT, Traits >::operator-> ( ) const
inline

Definition at line 78 of file regex_iter.hpp.

◆ operator==()

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
bool real::compat::regex_iterator< BidirIt, CharT, Traits >::operator== ( const regex_iterator< BidirIt, CharT, Traits > &  other) const
inline

Definition at line 108 of file regex_iter.hpp.

◆ sync_std()

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
void real::compat::regex_iterator< BidirIt, CharT, Traits >::sync_std ( )
inlineprivate

Syncs the std path from the wrapped std::regex_iterator.

Definition at line 159 of file regex_iter.hpp.

Member Data Documentation

◆ at_end_

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
bool real::compat::regex_iterator< BidirIt, CharT, Traits >::at_end_ {true}
private

Definition at line 135 of file regex_iter.hpp.

◆ begin_

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
BidirIt real::compat::regex_iterator< BidirIt, CharT, Traits >::begin_ {}
private

Definition at line 127 of file regex_iter.hpp.

◆ end_

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
BidirIt real::compat::regex_iterator< BidirIt, CharT, Traits >::end_ {}
private

Definition at line 128 of file regex_iter.hpp.

◆ flags_

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
regex_constants::match_flag_type real::compat::regex_iterator< BidirIt, CharT, Traits >::flags_ {regex_constants::match_default}
private

Definition at line 130 of file regex_iter.hpp.

◆ match_

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
value_type real::compat::regex_iterator< BidirIt, CharT, Traits >::match_
private

Definition at line 134 of file regex_iter.hpp.

◆ re_

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
const regex_type* real::compat::regex_iterator< BidirIt, CharT, Traits >::re_ {nullptr}
private

Definition at line 129 of file regex_iter.hpp.

◆ real_path_

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
bool real::compat::regex_iterator< BidirIt, CharT, Traits >::real_path_ {false}
private

Definition at line 131 of file regex_iter.hpp.

◆ real_pos_

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
std::size_t real::compat::regex_iterator< BidirIt, CharT, Traits >::real_pos_ {}
private

Definition at line 132 of file regex_iter.hpp.

◆ std_it_

template<typename BidirIt , typename CharT = typename std::iterator_traits<BidirIt>::value_type, typename Traits = std::regex_traits<CharT>>
std::optional<std::regex_iterator<BidirIt> > real::compat::regex_iterator< BidirIt, CharT, Traits >::std_it_
private

Definition at line 133 of file regex_iter.hpp.


The documentation for this class was generated from the following file: