STD::SUB_MATCH(3)

🌸 std::sub_match< _BiIter > β€” Library Functions Manual, section (3) πŸ’…

okay bestie, welcome to the group chat for std::sub_match< _BiIter >. this is a Library Functions Manual situation, section 3, and she's giving very much "I am one tiny piece of <regex> and I have OPINIONS." let's get into it 🫢


✨ NAME ✨

std::sub_match< _BiIter > β€” the little object that holds one matched sub-expression. no cap. πŸ‘‘


✨ SYNOPSIS ✨

#include <regex>

πŸŽ€ Public Types πŸŽ€

  • typedef __iter_traits::difference_type difference_type
  • typedef _BiIter iterator
  • typedef basic_string< value_type > string_type
  • typedef __iter_traits::value_type value_type

πŸ¦‹ Public Member Functions πŸ¦‹

  • int compare (const sub_match &__s) const β€” Compares this and 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) β€” Swap the values of two sub_match objects.
    • int compare (const string_type &__s) const β€” Compares this sub_match to a string.
    • int compare (const value_type *__s) const β€” Compares this sub_match to a string.

πŸ’– Public Attributes πŸ’–

  • iterator first
  • bool matched
  • iterator second
heads up bestie β€” (Note that these are not member symbols.) they're just, like, the friends she rolls with. 😌
  • 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." ✨ okay so that's the whole personality.

An object of this class is basically a pair of iterators marking a matched subexpression inside a regular expression pattern match. and the way that she can be converted to and compared with std::basic_string objects of the same character type as the pattern matched by the regular expression?? iconic behaviour, honestly.

A sub_match<Iter> has a public base class of type pair<Iter, Iter>, so she 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. no cap, half-open, meaning it does not include the second one. πŸ’…

Since β€” C++11 (vintage, but in a baby way 🌸)


🧚 Member Function Documentation 🧚

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 this sub_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.

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< const char * >::operator==(), and std::sub_match< const char * >::operator==(). (yes bestie, it's listed twice, we don't make the rules 😭)

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 this sub_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.

template<typename _BiIter> difference_type std::sub_match< _BiIter >::length () const [inline], [noexcept]

Gets the length of the matching sequence. that's it. that's the function. noexcept queen πŸ‘‘

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.

This is the implicit conversion operator. It is identical to the str() member function except that it will want to pop up in unexpected places and cause a great deal of confusion and cursing from the unwary. πŸ’€ bestie this is a WARNING. she will show up uninvited. she is the main character. she was not on the guest list. πŸ™ˆ

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< const char * >::operator string_type().

template<typename _BiIter> void std::sub_match< _BiIter >::swap (sub_match< _BiIter > & __s) [inline], [noexcept]

Swap the values of two sub_match objects. trading places, very freaky friday of them πŸ”₯


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. (not a human, just a very dedicated robot, we stan 🫢)


okay that's the whole page, love u, bye πŸ’– β€” this has been std::sub_m...< _BiIter >(3), brought to you by libstdc++, and remember: no gatekeeping regex. periodt. πŸŒˆπŸŽ€βœ¨

πŸ“¦ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms