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

A matched sub-expression: a [first, second) range into the searched sequence. More...

#include <regex_match.hpp>

Public Types

using iterator = BidirIt
 The underlying iterator.
 
using value_type = typename std::iterator_traits< BidirIt >::value_type
 The character type.
 
using difference_type = typename std::iterator_traits< BidirIt >::difference_type
 Distance type.
 
using string_type = std::basic_string< value_type >
 The owning string type.
 

Public Member Functions

difference_type length () const
 Length of the sub-match (0 if it did not participate).
 
string_type str () const
 The matched text as an owned string (empty if it did not participate).
 
 operator string_type () const
 Implicit conversion to the owned string (std::sub_match parity).
 
std::basic_string_view< value_typeview () const
 A non-owning view of the matched text.
 
int compare (const string_type &other) const
 Three-way length/lexicographic comparison against a string (std::sub_match::compare).
 
int compare (const sub_match &other) const
 

Public Attributes

BidirIt first {}
 Start of the sub-match.
 
BidirIt second {}
 One past the end of the sub-match.
 
bool matched {false}
 Whether this sub-expression participated.
 

Detailed Description

template<typename BidirIt>
class real::compat::sub_match< BidirIt >

A matched sub-expression: a [first, second) range into the searched sequence.

Contiguous iterators only — sub_match is built from byte offsets, which requires the underlying storage to be contiguous (a std::deque::iterator is random-access but not contiguous, so it is rejected).

Template Parameters
BidirItA contiguous iterator into the searched sequence.

Definition at line 29 of file regex_match.hpp.

Member Typedef Documentation

◆ difference_type

template<typename BidirIt >
using real::compat::sub_match< BidirIt >::difference_type = typename std::iterator_traits<BidirIt>::difference_type

Distance type.

Definition at line 38 of file regex_match.hpp.

◆ iterator

template<typename BidirIt >
using real::compat::sub_match< BidirIt >::iterator = BidirIt

The underlying iterator.

Definition at line 36 of file regex_match.hpp.

◆ string_type

template<typename BidirIt >
using real::compat::sub_match< BidirIt >::string_type = std::basic_string<value_type>

The owning string type.

Definition at line 39 of file regex_match.hpp.

◆ value_type

template<typename BidirIt >
using real::compat::sub_match< BidirIt >::value_type = typename std::iterator_traits<BidirIt>::value_type

The character type.

Definition at line 37 of file regex_match.hpp.

Member Function Documentation

◆ compare() [1/2]

template<typename BidirIt >
int real::compat::sub_match< BidirIt >::compare ( const string_type other) const
inline

Three-way length/lexicographic comparison against a string (std::sub_match::compare).

Definition at line 72 of file regex_match.hpp.

◆ compare() [2/2]

template<typename BidirIt >
int real::compat::sub_match< BidirIt >::compare ( const sub_match< BidirIt > &  other) const
inline

Definition at line 77 of file regex_match.hpp.

◆ length()

template<typename BidirIt >
difference_type real::compat::sub_match< BidirIt >::length ( ) const
inline

Length of the sub-match (0 if it did not participate).

Definition at line 46 of file regex_match.hpp.

◆ operator string_type()

template<typename BidirIt >
real::compat::sub_match< BidirIt >::operator string_type ( ) const
inline

Implicit conversion to the owned string (std::sub_match parity).

Definition at line 58 of file regex_match.hpp.

◆ str()

template<typename BidirIt >
string_type real::compat::sub_match< BidirIt >::str ( ) const
inline

The matched text as an owned string (empty if it did not participate).

Definition at line 52 of file regex_match.hpp.

◆ view()

template<typename BidirIt >
std::basic_string_view< value_type > real::compat::sub_match< BidirIt >::view ( ) const
inline

A non-owning view of the matched text.

Definition at line 64 of file regex_match.hpp.

Member Data Documentation

◆ first

template<typename BidirIt >
BidirIt real::compat::sub_match< BidirIt >::first {}

Start of the sub-match.

Definition at line 41 of file regex_match.hpp.

◆ matched

template<typename BidirIt >
bool real::compat::sub_match< BidirIt >::matched {false}

Whether this sub-expression participated.

Definition at line 43 of file regex_match.hpp.

◆ second

template<typename BidirIt >
BidirIt real::compat::sub_match< BidirIt >::second {}

One past the end of the sub-match.

Definition at line 42 of file regex_match.hpp.


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