STD::SUB_MATCH(3cxx)
πΈ NAME πΈ
std::sub_match< _BiIter > β bestie, this is the libstdc++ manual page for that regex matched-subexpression type. Itβs a 3cxx page, and the manual name is folded up here right at the top like a little name tag π
.
π SYNOPSIS π
#include <regex>
β¨ Public Types β¨
typedef __iter_traits::difference_type difference_typetypedef _BiIter iteratortypedef basic_string< value_type > string_typetypedef __iter_traits::value_type value_type
π Public Member Functions π
int compare (const sub_match &__s) constβ compares this matched sequence to another matched sequence.difference_type length () const noexceptβ gets the length of the matching sequence.operator string_type () constβ gets the matching sequence as a string.string_type str () constβ gets the matching sequence as a string.void swap (sub_match &__s) noexcept(__is_nothrow_swappable< _BiIter >::value)β swaps the values of twosub_matchobjects.int compare (const string_type &__s) constβ compares thissub_matchto a string.int compare (const value_type *__s) constβ compares thissub_matchto a string.
tiny formatting note: the manpage tucks those last two compare overloads right under swap; theyβre still here, in the exact same order, just flattened so your eyes donβt have to do parkour π«Ά.
π¦ Public Attributes π¦
iterator firstbool matchediterator second
π₯ Related Symbols π₯
Note: these are not member symbols, bestie.
template<typename _BiIter > bool operator== (const sub_match< _BiIter > &__lhs, const sub_match< _BiIter > &__rhs)β tests the equivalence of two regular expression submatches.template<typename _BiIter > auto operator (const sub_match< _BiIter > &__lhs, const sub_match< _BiIter > &__rhs) noexcept(__detail::__is_contiguous_iter< _BiIter >::value)β three-way comparison of two regular expression submatches.template<typename _Bi_iter , typename _Ch_traits , typename _Ch_alloc > bool operator== (const sub_match< _Bi_iter > &__lhs, const __sub_match_string< _Bi_iter, _Ch_traits, _Ch_alloc > &__rhs)β tests the equivalence of a regular expression submatch and a string.template<typename _Bi_iter , typename _Ch_traits , typename _Alloc > auto operator (const sub_match< _Bi_iter > &__lhs, const __sub_match_string< _Bi_iter, _Ch_traits, _Alloc > &__rhs) noexcept(__detail::__is_contiguous_iter< _Bi_iter >::value)β three-way comparison of a regular expression submatch and a string.template<typename _Bi_iter > bool operator== (const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const *__rhs)β tests the equivalence of a regular expression submatch and a C string.template<typename _Bi_iter > auto operator (const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const *__rhs) noexcept(__detail::__is_contiguous_iter< _Bi_iter >::value)β three-way comparison of a regular expression submatch and a C string.template<typename _Bi_iter > bool operator== (const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const &__rhs)β tests the equivalence of a regular expression submatch and a character.template<typename _Bi_iter > auto operator (const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const &__rhs) noexcept(__detail::__is_contiguous_iter< _Bi_iter >::value)β three-way comparison of a regular expression submatch and a character.template<typename _Ch_type , typename _Ch_traits , typename _Bi_iter > basic_ostream< _Ch_type, _Ch_traits > & operator<< (basic_ostream< _Ch_type, _Ch_traits > &__os, const sub_match< _Bi_iter > &__m)β inserts a matched string into an output stream.
π Detailed Description π
template<typename _BiIter>
class std::sub_match< _BiIter >"A sequence of characters matched by a
particular marked sub-expression.
yes, bestie, that stray " is literally in the manpage β Iβm not fixing it, Iβm respecting the source π
.
Think of an object of this class as basically a pair of iterators marking a matched subexpression inside a regular expression pattern match. These objects can be converted to and compared with std::basic_string objects, as long as the character type is the same one used by the pattern matched by the regular expression.
A sub_match<Iter> has a public base class of type pair<Iter, Iter>, so it inherits pairβs data members named first and second. The iterators that make up the pair are the usual half-open interval referencing the actual original pattern matched.
π± Since
C++11
π§ Member Function Documentation π§
π compare (const string_type & __s) const [inline]
template<typename _BiIter > int std::sub_match< _BiIter >::compare (const string_type & __s) const [inline]
Compares this sub_match to a string.
Parameters
__sβ a string to compare to thissub_match.
Return values
negativeβ this matched sequence will collate before__s.zeroβ this matched sequence is equivalent to__s.positiveβ this matched sequence will collate after__s.
π compare (const sub_match< _BiIter > & __s) const [inline]
template<typename _BiIter > int std::sub_match< _BiIter >::compare (const sub_match< _BiIter > & __s) const [inline]
Compares this and another matched sequence.
Parameters
__sβ another matched sequence to compare to this one.
Return values
negativeβ this matched sequence will collate before__s.zeroβ this matched sequence is equivalent to__s.positiveβ this matched sequence will collate after__s.
Referenced by std::sub_match< _BiIter >::operator==(), and std::sub_match< _BiIter >::operator==().
π compare (const value_type * __s) const [inline]
template<typename _BiIter > int std::sub_match< _BiIter >::compare (const value_type * __s) const [inline]
Compares this sub_match to a string.
Parameters
__sβ a string to compare to thissub_match.
Return values
negativeβ this matched sequence will collate before__s.zeroβ this matched sequence is equivalent to__s.positiveβ this matched sequence will collate after__s.
π¦ length () const [inline], [noexcept]
template<typename _BiIter > difference_type std::sub_match< _BiIter >::length () const [inline], [noexcept]
Gets the length of the matching sequence.
References std::distance().
π¦ operator string_type () const [inline]
template<typename _BiIter > std::sub_match< _BiIter >::operator string_type () const [inline]
Gets the matching sequence as a string.
Returns
- the matching sequence as a string.
β οΈ Sheβs the implicit conversion operator, bestie. She is identical to the str() member function except that she will want to pop up in unexpected places and cause a great deal of confusion and cursing from the unwary. Youβve been warned π.
References std::sub_match< _BiIter >::str().
π¦ str () const [inline]
template<typename _BiIter > string_type std::sub_match< _BiIter >::str () const [inline]
Gets the matching sequence as a string.
Returns
- the matching sequence as a string.
Referenced by std::sub_match< _BiIter >::operator string_type().
π swap (sub_match< _BiIter > & __s) [inline], [noexcept]
template<typename _BiIter > void std::sub_match< _BiIter >::swap (sub_match< _BiIter > & __s) [inline], [noexcept]
Swap the values of two sub_match objects.
References std::pair< _T1, _T2 >::swap().
π Author π
Generated automatically by Doxygen for libstdc++ from the source code. (Yes, our girl was literally generated by Doxygen β no cap.)
okay bestie, thatβs the whole page: source/version is libstdc++, and the footer doesnβt give a date on this one, so Iβm not inventing one. The manual name and 3cxx are folded up top, the vibes are immaculate, and the facts are all still here. Periodt. π
β¨ππ«Ά
π¦ 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