31 namespace std _GLIBCXX_VISIBILITY(default)
33 _GLIBCXX_BEGIN_NAMESPACE_VERSION
50 template<
typename _Ch_type>
54 typedef _Ch_type char_type;
60 typedef typename std::ctype<char_type>::mask _BaseType;
62 unsigned char _M_extended;
63 static constexpr
unsigned char _S_under = 1 << 0;
65 static constexpr
unsigned char _S_blank = 1 << 1;
66 static constexpr
unsigned char _S_valid_mask = 0x3;
68 constexpr _RegexMask(_BaseType
__base = 0,
69 unsigned char __extended = 0)
70 : _M_base(
__base), _M_extended(__extended)
76 return _RegexMask(_M_base & __other._M_base,
77 _M_extended & __other._M_extended);
83 return _RegexMask(_M_base | __other._M_base,
84 _M_extended | __other._M_extended);
90 return _RegexMask(_M_base ^ __other._M_base,
91 _M_extended ^ __other._M_extended);
96 {
return _RegexMask(~_M_base, ~_M_extended); }
99 operator&=(_RegexMask __other)
100 {
return *
this = (*this) & __other; }
102 constexpr _RegexMask&
103 operator|=(_RegexMask __other)
104 {
return *
this = (*this) | __other; }
106 constexpr _RegexMask&
107 operator^=(_RegexMask __other)
108 {
return *
this = (*this) ^ __other; }
111 operator==(_RegexMask __other)
const
113 return (_M_extended & _S_valid_mask)
114 == (__other._M_extended & _S_valid_mask)
115 && _M_base == __other._M_base;
119 operator!=(_RegexMask __other)
const
120 {
return !((*this) == __other); }
124 typedef _RegexMask char_class_type;
144 {
return string_type::traits_type::length(__p); }
170 const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
171 return __fctyp.tolower(__c);
194 template<
typename _Fwd_iter>
199 const __collate_type& __fclt(use_facet<__collate_type>(_M_locale));
201 return __fclt.transform(__s.
data(), __s.
data() + __s.
size());
218 template<
typename _Fwd_iter>
225 const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
228 __fctyp.tolower(&*__v.
begin(), &*__v.
end());
248 template<
typename _Fwd_iter>
289 template<
typename _Fwd_iter>
292 bool __icase =
false)
const;
307 isctype(_Ch_type __c, char_class_type __f)
const;
320 value(_Ch_type __ch,
int __radix)
const;
336 std::swap(_M_locale, __loc);
346 {
return _M_locale; }
349 locale_type _M_locale;
352 template<
typename _Ch_type>
353 template<
typename _Fwd_iter>
354 typename regex_traits<_Ch_type>::string_type
359 const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
361 static const char* __collatenames[] =
454 "left-square-bracket",
456 "right-square-bracket",
486 "left-curly-bracket",
488 "right-curly-bracket",
495 static const char* __digraphs[] =
522 string_type a(__first, __last);
523 __fctyp.narrow(__first, __last,
'?', &*__s.begin());
525 for (
unsigned int __i = 0; *__collatenames[__i]; __i++)
526 if (__s == __collatenames[__i])
527 return string_type(1, __fctyp.widen((
char)__i));
529 for (
unsigned int __i = 0; *__digraphs[__i]; __i++)
531 const char* __now = __digraphs[__i];
534 string_type ret(__s.size(), __fctyp.widen(
'?'));
535 __fctyp.widen(__now, __now + 2, &*ret.begin());
539 return string_type();
542 template<
typename _Ch_type>
543 template<
typename _Fwd_iter>
544 typename regex_traits<_Ch_type>::char_class_type
550 typedef const pair<const char*, char_class_type> _ClassnameEntry;
551 const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
552 const __cctype_type& __cctyp(use_facet<__cctype_type>(_M_locale));
554 static _ClassnameEntry __classnames[] =
556 {
"d", ctype_base::digit},
557 {
"w", {ctype_base::alnum, _RegexMask::_S_under}},
558 {
"s", ctype_base::space},
559 {
"alnum", ctype_base::alnum},
560 {
"alpha", ctype_base::alpha},
561 {
"blank", {0, _RegexMask::_S_blank}},
562 {
"cntrl", ctype_base::cntrl},
563 {
"digit", ctype_base::digit},
564 {
"graph", ctype_base::graph},
565 {
"lower", ctype_base::lower},
566 {
"print", ctype_base::print},
567 {
"punct", ctype_base::punct},
568 {
"space", ctype_base::space},
569 {
"upper", ctype_base::upper},
570 {
"xdigit", ctype_base::xdigit},
574 __fctyp.narrow(__first, __last,
'?', &__s[0]);
575 __cctyp.tolower(&*__s.begin(), &*__s.end());
576 for (_ClassnameEntry* __it = __classnames;
577 __it < *(&__classnames + 1);
580 if (__s == __it->first)
583 && ((__it->second & (ctype_base::lower | ctype_base::upper)) != 0))
584 return ctype_base::alpha;
591 template<
typename _Ch_type>
594 isctype(_Ch_type __c, char_class_type __f)
const
597 const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
599 return __fctyp.is(__f._M_base, __c)
601 || ((__f._M_extended & _RegexMask::_S_under)
602 && __c == __fctyp.widen(
'_'))
604 || ((__f._M_extended & _RegexMask::_S_blank)
605 && (__c == __fctyp.widen(
' ')
606 || __c == __fctyp.widen(
'\t')));
609 template<
typename _Ch_type>
612 value(_Ch_type __ch,
int __radix)
const
618 else if (__radix == 16)
621 return __is.
fail() ? -1 : __v;
632 template<
typename _Ch_type,
typename _Rx_traits = regex_traits<_Ch_type> >
637 typedef _Ch_type value_type;
638 typedef _Rx_traits traits_type;
639 typedef typename traits_type::string_type string_type;
641 typedef typename traits_type::locale_type locale_type;
666 : _M_flags(ECMAScript),
667 _M_automaton(__detail::__compile<const _Ch_type*, _Rx_traits>(0, 0,
668 _M_traits, _M_flags))
685 _M_automaton(__detail::__compile(__p, __p + _Rx_traits::length(__p),
686 _M_traits, _M_flags))
701 basic_regex(
const _Ch_type* __p, std::size_t __len, flag_type __f)
703 _M_automaton(__detail::__compile(__p, __p + __len, _M_traits, _M_flags))
712 : _M_flags(__rhs._M_flags), _M_traits(__rhs._M_traits),
713 _M_automaton(__rhs._M_automaton)
722 : _M_flags(__rhs._M_flags), _M_traits(__rhs._M_traits),
723 _M_automaton(std::move(__rhs._M_automaton))
735 template<
typename _Ch_traits,
typename _Ch_alloc>
739 flag_type __f = ECMAScript)
741 _M_automaton(__detail::__compile(__s.
begin(), __s.
end(),
742 _M_traits, _M_flags))
758 template<
typename _InputIterator>
760 flag_type __f = ECMAScript)
762 _M_automaton(__detail::__compile(__first, __last, _M_traits, _M_flags))
774 flag_type __f = ECMAScript)
776 _M_automaton(__detail::__compile(__l.
begin(), __l.
end(),
777 _M_traits, _M_flags))
791 {
return this->
assign(__rhs); }
798 {
return this->
assign(std::move(__rhs)); }
817 template<
typename _Ch_typeraits,
typename _Alloc>
863 assign(
const _Ch_type* __p, flag_type __flags = ECMAScript)
864 {
return this->
assign(string_type(__p), __flags); }
880 assign(
const _Ch_type* __p, std::size_t __len, flag_type __flags)
881 {
return this->
assign(string_type(__p, __len), __flags); }
894 template<
typename _Ch_typeraits,
typename _Alloc>
897 flag_type __flags = ECMAScript)
917 template<
typename _InputIterator>
919 assign(_InputIterator __first, _InputIterator __last,
920 flag_type __flags = ECMAScript)
921 {
return this->
assign(string_type(__first, __last), __flags); }
936 {
return this->
assign(__l.begin(), __l.end(), __flags); }
945 {
return _M_automaton->_M_sub_count() - 1; }
963 {
return _M_traits.imbue(__loc); }
971 {
return _M_traits.getloc(); }
982 std::swap(_M_flags, __rhs._M_flags);
983 std::swap(_M_traits, __rhs._M_traits);
984 std::swap(_M_automaton, __rhs._M_automaton);
987 #ifdef _GLIBCXX_DEBUG
990 { _M_automaton->_M_dot(__ostr); }
994 _M_get_automaton()
const
995 {
return _M_automaton; }
999 _Rx_traits _M_traits;
1006 #ifdef _GLIBCXX_USE_WCHAR_T
1018 template<
typename _Ch_type,
typename _Rx_traits>
1022 { __lhs.
swap(__rhs); }
1038 template<
typename _BiIter>
1041 typedef iterator_traits<_BiIter> __iter_traits;
1044 typedef typename __iter_traits::value_type value_type;
1045 typedef typename __iter_traits::difference_type difference_type;
1046 typedef _BiIter iterator;
1072 return this->matched
1085 return this->matched
1137 #ifdef _GLIBCXX_USE_WCHAR_T
1153 template<
typename _BiIter>
1156 {
return __lhs.
compare(__rhs) == 0; }
1164 template<
typename _BiIter>
1167 {
return __lhs.
compare(__rhs) != 0; }
1175 template<
typename _BiIter>
1178 {
return __lhs.
compare(__rhs) < 0; }
1186 template<
typename _BiIter>
1189 {
return __lhs.
compare(__rhs) <= 0; }
1197 template<
typename _BiIter>
1200 {
return __lhs.
compare(__rhs) >= 0; }
1208 template<
typename _BiIter>
1211 {
return __lhs.
compare(__rhs) > 0; }
1214 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1215 using __sub_match_string = basic_string<
1216 typename iterator_traits<_Bi_iter>::value_type,
1217 _Ch_traits, _Ch_alloc>;
1226 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1239 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1243 {
return !(__lhs == __rhs); }
1251 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1253 operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1255 {
return __rhs.
compare(__lhs.c_str()) > 0; }
1263 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1267 {
return __rhs < __lhs; }
1275 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1279 {
return !(__lhs < __rhs); }
1287 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1289 operator<=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1291 {
return !(__rhs < __lhs); }
1300 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1313 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1317 {
return !(__lhs == __rhs); }
1325 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1327 operator<(const sub_match<_Bi_iter>& __lhs,
1329 {
return __lhs.
compare(__rhs.c_str()) < 0; }
1337 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1341 {
return __rhs < __lhs; }
1349 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1353 {
return !(__lhs < __rhs); }
1361 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1363 operator<=(const sub_match<_Bi_iter>& __lhs,
1365 {
return !(__rhs < __lhs); }
1374 template<
typename _Bi_iter>
1376 operator==(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1378 {
return __rhs.
compare(__lhs) == 0; }
1387 template<
typename _Bi_iter>
1389 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1391 {
return !(__lhs == __rhs); }
1399 template<
typename _Bi_iter>
1401 operator<(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1403 {
return __rhs.
compare(__lhs) > 0; }
1411 template<
typename _Bi_iter>
1413 operator>(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1415 {
return __rhs < __lhs; }
1423 template<
typename _Bi_iter>
1425 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1427 {
return !(__lhs < __rhs); }
1435 template<
typename _Bi_iter>
1437 operator<=(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1439 {
return !(__rhs < __lhs); }
1448 template<
typename _Bi_iter>
1451 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1452 {
return __lhs.
compare(__rhs) == 0; }
1461 template<
typename _Bi_iter>
1464 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1465 {
return !(__lhs == __rhs); }
1473 template<
typename _Bi_iter>
1475 operator<(const sub_match<_Bi_iter>& __lhs,
1476 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1477 {
return __lhs.compare(__rhs) < 0; }
1485 template<
typename _Bi_iter>
1488 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1489 {
return __rhs < __lhs; }
1497 template<
typename _Bi_iter>
1500 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1501 {
return !(__lhs < __rhs); }
1509 template<
typename _Bi_iter>
1511 operator<=(const sub_match<_Bi_iter>& __lhs,
1512 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1513 {
return !(__rhs < __lhs); }
1522 template<
typename _Bi_iter>
1524 operator==(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1528 return __rhs.
compare(string_type(1, __lhs)) == 0;
1538 template<
typename _Bi_iter>
1540 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1542 {
return !(__lhs == __rhs); }
1550 template<
typename _Bi_iter>
1552 operator<(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1556 return __rhs.
compare(string_type(1, __lhs)) > 0;
1565 template<
typename _Bi_iter>
1567 operator>(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1569 {
return __rhs < __lhs; }
1577 template<
typename _Bi_iter>
1579 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1581 {
return !(__lhs < __rhs); }
1589 template<
typename _Bi_iter>
1591 operator<=(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1593 {
return !(__rhs < __lhs); }
1602 template<
typename _Bi_iter>
1605 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1608 return __lhs.
compare(string_type(1, __rhs)) == 0;
1618 template<
typename _Bi_iter>
1621 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1622 {
return !(__lhs == __rhs); }
1630 template<
typename _Bi_iter>
1632 operator<(const sub_match<_Bi_iter>& __lhs,
1633 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1636 return __lhs.
compare(string_type(1, __rhs)) < 0;
1645 template<
typename _Bi_iter>
1648 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1649 {
return __rhs < __lhs; }
1657 template<
typename _Bi_iter>
1660 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1661 {
return !(__lhs < __rhs); }
1669 template<
typename _Bi_iter>
1671 operator<=(const sub_match<_Bi_iter>& __lhs,
1672 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1673 {
return !(__rhs < __lhs); }
1683 template<
typename _Ch_type,
typename _Ch_traits,
typename _Bi_iter>
1685 basic_ostream<_Ch_type, _Ch_traits>&
1686 operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
1688 {
return __os << __m.
str(); }
1695 template<
typename _Bi_iter>
1696 inline const sub_match<_Bi_iter>&
1699 static const sub_match<_Bi_iter> __unmatched = sub_match<_Bi_iter>();
1725 template<
typename _Bi_iter,
1726 typename _Alloc = allocator<sub_match<_Bi_iter> > >
1728 :
private std::vector<sub_match<_Bi_iter>, _Alloc>
1743 typedef std::iterator_traits<_Bi_iter> __iter_traits;
1751 typedef _Alloc allocator_type;
1755 typedef typename _Base_type::const_iterator const_iterator;
1756 typedef const_iterator iterator;
1757 typedef typename __iter_traits::difference_type difference_type;
1758 typedef typename __iter_traits::value_type char_type;
1848 return (__size && _Base_type::operator[](0).matched) ? __size - 2 : 0;
1862 {
return size() == 0; }
1881 {
return (*
this)[__sub].length(); }
1900 (*
this)[__sub].first) : -1;
1913 str(size_type __sub = 0)
const
1914 {
return (*
this)[__sub].str(); }
1930 _GLIBCXX_DEBUG_ASSERT(
ready() );
1931 return __sub <
size()
1933 : __unmatched_sub<_Bi_iter>();
1947 _GLIBCXX_DEBUG_ASSERT(
ready() );
1950 : __unmatched_sub<_Bi_iter>();
1964 _GLIBCXX_DEBUG_ASSERT(
ready() );
1967 : __unmatched_sub<_Bi_iter>();
2014 template<
typename _Out_iter>
2016 format(_Out_iter __out,
const char_type* __fmt_first,
2017 const char_type* __fmt_last,
2024 template<
typename _Out_iter,
typename _St,
typename _Sa>
2036 template<
typename _Out_iter,
typename _St,
typename _Sa>
2072 {
return _Base_type::get_allocator(); }
2093 typedef match_results<const char*> cmatch;
2094 typedef match_results<string::const_iterator> smatch;
2095 #ifdef _GLIBCXX_USE_WCHAR_T
2096 typedef match_results<const wchar_t*> wcmatch;
2097 typedef match_results<wstring::const_iterator> wsmatch;
2106 template<
typename _Bi_iter,
typename _Alloc>
2130 template<
typename _Bi_iter,
class _Alloc>
2134 {
return !(__m1 == __m2); }
2144 template<
typename _Bi_iter,
typename _Alloc>
2148 { __lhs.
swap(__rhs); }
2173 template<
typename _Bi_iter,
typename _Alloc,
2174 typename _Ch_type,
typename _Rx_traits>
2184 __detail::_Automaton::_SizeT __sz = __a->_M_sub_count();
2187 return __a->_M_get_matcher(__cs, __r, __a, __flags)->_M_match();
2204 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2212 return regex_match(__first, __last, __what, __re, __flags);
2229 template<
typename _Ch_type,
typename _Alloc,
typename _Rx_traits>
2236 {
return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); }
2252 template<
typename _Ch_traits,
typename _Ch_alloc,
2253 typename _Alloc,
typename _Ch_type,
typename _Rx_traits>
2257 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2276 template<
typename _Ch_type,
class _Rx_traits>
2282 {
return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
2297 template<
typename _Ch_traits,
typename _Str_allocator,
2298 typename _Ch_type,
typename _Rx_traits>
2322 template<
typename _Bi_iter,
typename _Alloc,
2323 typename _Ch_type,
typename _Rx_traits>
2332 __detail::_Automaton::_SizeT __sz = __a->_M_sub_count();
2335 for (
auto __cur = __first; __cur != __last; ++__cur)
2338 auto __matcher = __a->_M_get_matcher(__curs, __r, __a, __flags);
2339 if (__matcher->_M_search_from_first())
2341 __r._M_set_range(__m.
size(),
2343 {__first, __m[0].first});
2344 __r._M_set_range(__m.
size()+1,
2346 {__m[0].second, __last});
2347 __r._M_set_matched(__m.
size(),
2349 __r._M_set_matched(__m.
size()+1,
2369 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2377 return regex_search(__first, __last, __what, __re, __flags);
2392 template<
typename _Ch_type,
class _Alloc,
class _Rx_traits>
2399 {
return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
2411 template<
typename _Ch_type,
typename _Rx_traits>
2417 {
return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
2429 template<
typename _Ch_traits,
typename _String_allocator,
2430 typename _Ch_type,
typename _Rx_traits>
2433 _String_allocator>& __s,
2437 {
return regex_search(__s.begin(), __s.end(), __e, __flags); }
2451 template<
typename _Ch_traits,
typename _Ch_alloc,
2452 typename _Alloc,
typename _Ch_type,
2453 typename _Rx_traits>
2457 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2478 template<
typename _Out_iter,
typename _Bi_iter,
2479 typename _Rx_traits,
typename _Ch_type>
2499 template<
typename _Rx_traits,
typename _Ch_type>
2500 inline basic_string<_Ch_type>
2509 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2520 template<
typename _Bi_iter,
2521 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2522 typename _Rx_traits = regex_traits<_Ch_type> >
2528 typedef std::ptrdiff_t difference_type;
2551 : _M_begin(__a), _M_end(__b), _M_pregex(&__re), _M_flags(__m), _M_match()
2552 {
regex_search(_M_begin, _M_end, _M_match, *_M_pregex, _M_flags); }
2576 {
return !(*
this == __rhs); }
2583 {
return _M_match; }
2590 {
return &_M_match; }
2612 const regex_type* _M_pregex;
2617 template<
typename _Bi_iter,
2619 typename _Rx_traits>
2624 return (_M_match.empty() && __rhs._M_match.
empty())
2625 || (_M_begin == __rhs._M_begin
2626 && _M_end == __rhs._M_end
2627 && _M_pregex == __rhs._M_pregex
2628 && _M_flags == __rhs._M_flags
2629 && _M_match[0] == __rhs._M_match[0]);
2632 template<
typename _Bi_iter,
2634 typename _Rx_traits>
2645 if (_M_match[0].matched)
2647 auto __start = _M_match[0].second;
2648 if (_M_match[0].first == _M_match[0].second)
2649 if (__start == _M_end)
2656 if (
regex_search(__start, _M_end, _M_match, *_M_pregex, _M_flags
2664 if (!
regex_search(__start, _M_end, _M_match, *_M_pregex, _M_flags))
2672 #ifdef _GLIBCXX_USE_WCHAR_T
2685 template<
typename _Bi_iter,
2686 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2693 typedef std::ptrdiff_t difference_type;
2707 : _M_position(), _M_result(nullptr), _M_suffix(), _M_n(0), _M_subs()
2731 : _M_position(__a, __b, __re, __m), _M_subs(1, __submatch), _M_n(0)
2732 { _M_init(__a, __b); }
2748 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2749 { _M_init(__a, __b); }
2765 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2766 { _M_init(__a, __b); }
2777 template<std::
size_t _Nm>
2780 const int (&__submatches)[_Nm],
2783 : _M_position(__a, __b, __re, __m),
2784 _M_subs(__submatches, *(&__submatches+1)), _M_n(0)
2785 { _M_init(__a, __b); }
2792 : _M_position(__rhs.position), _M_subs(__rhs.subs), _M_n(__rhs.N),
2793 _M_result(__rhs.result), _M_suffix(__rhs.suffix),
2794 _M_has_m1(__rhs._M_has_m1)
2796 if (__rhs._M_result == &__rhs._M_suffix)
2797 _M_result = &_M_suffix;
2818 {
return !(*
this == __rhs); }
2825 {
return *_M_result; }
2832 {
return _M_result; }
2855 _M_init(_Bi_iter __a, _Bi_iter __b);
2858 _M_current_match()
const
2860 if (_M_subs[_M_n] == -1)
2861 return (*_M_position).prefix();
2863 return (*_M_position)[_M_subs[_M_n]];
2867 _M_end_of_seq()
const
2868 {
return _M_result !=
nullptr; }
2870 _Position _M_position;
2871 const value_type* _M_result;
2872 value_type _M_suffix;
2880 template<
typename _Bi_iter,
2882 typename _Rx_traits>
2883 regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>&
2887 _M_position = __rhs._M_position;
2888 _M_subs = __rhs._M_subs;
2890 _M_result = __rhs._M_result;
2891 _M_suffix = __rhs._M_suffix;
2892 _M_has_m1 = __rhs._M_has_m1;
2893 if (__rhs._M_result == &__rhs._M_suffix)
2894 _M_result = &_M_suffix;
2897 template<
typename _Bi_iter,
2899 typename _Rx_traits>
2904 if (_M_end_of_seq() && __rhs._M_end_of_seq())
2906 if (_M_suffix.matched && __rhs._M_suffix.matched
2907 && _M_suffix == __rhs._M_suffix)
2909 if (_M_end_of_seq() || _M_suffix.matched
2910 || __rhs._M_end_of_seq() || __rhs._M_suffix.matched)
2912 return _M_position == __rhs._M_position
2913 && _M_n == __rhs._M_n
2914 && _M_subs == __rhs._M_subs;
2917 template<
typename _Bi_iter,
2919 typename _Rx_traits>
2924 _Position __prev = _M_position;
2925 if (_M_suffix.matched)
2927 else if (_M_n + 1 < _M_subs.size())
2930 _M_result = &_M_current_match();
2936 if (_M_position != _Position())
2937 _M_result = &_M_current_match();
2938 else if (_M_has_m1 && __prev->suffix().length() != 0)
2940 _M_suffix.matched =
true;
2941 _M_suffix.first = __prev->suffix().first;
2942 _M_suffix.second = __prev->suffix().second;
2943 _M_result = &_M_suffix;
2951 template<
typename _Bi_iter,
2953 typename _Rx_traits>
2956 _M_init(_Bi_iter __a, _Bi_iter __b)
2959 for (
auto __it : _M_subs)
2965 if (_M_position != _Position())
2966 _M_result = &_M_current_match();
2969 _M_suffix.matched =
true;
2970 _M_suffix.first = __a;
2971 _M_suffix.second = __b;
2972 _M_result = &_M_suffix;
2975 _M_result =
nullptr;
2984 #ifdef _GLIBCXX_USE_WCHAR_T
2993 _GLIBCXX_END_NAMESPACE_VERSION