2019-05-14 Jonathan Wakely <jwakely@redhat.com>
+ * include/bits/regex.h (match_results::max_size()): Adjust return
+ value to account for prefix/suffix/unmatched subs.
+ (match_results::_M_resize(unsigned int)): Use _Base_type::assign to
+ reset the contained sub matches.
+ (match_results::_M_establish_failed_match(_Bi_iter)): Add new member
+ function to set result state following a failed match.
+ * include/bits/regex.tcc (__regex_algo_impl): Remove loop to set
+ sub_match states after _M_resize. Use _M_establish_failed_match.
+
PR libstdc++/69724
* include/std/thread (thread::_State_impl, thread::_S_make_state):
Replace single _Callable parameter with variadic _Args pack, to
size_type
max_size() const noexcept
- { return _Base_type::max_size(); }
+ { return _Base_type::max_size() - 3; }
/**
* @brief Indicates if the %match_results contains no results.
const basic_regex<_Cp, _Rp>&,
regex_constants::match_flag_type);
+ // Reset contents to __size unmatched sub_match objects
+ // (plus additional objects for prefix, suffix and unmatched sub).
void
_M_resize(unsigned int __size)
- { _Base_type::resize(__size + 3); }
+ { _Base_type::assign(__size + 3, sub_match<_Bi_iter>{}); }
+
+ // Set state to a failed match for the given past-the-end iterator.
+ void
+ _M_establish_failed_match(_Bi_iter __end)
+ {
+ sub_match<_Bi_iter> __sm;
+ __sm.first = __sm.second = __end;
+ _Base_type::assign(3, __sm);
+ }
const_reference
_M_unmatched_sub() const
typename match_results<_BiIter, _Alloc>::_Base_type& __res = __m;
__m._M_begin = __s;
__m._M_resize(__re._M_automaton->_M_sub_count());
- for (auto& __it : __res)
- __it.matched = false;
bool __ret;
if ((__re.flags() & regex_constants::__polynomial)
}
else
{
- __m._M_resize(0);
- for (auto& __it : __res)
- {
- __it.matched = false;
- __it.first = __it.second = __e;
- }
+ __m._M_establish_failed_match(__e);
}
return __ret;
}