diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2019-05-14 13:19:05 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2019-05-14 13:19:05 +0100 |
commit | 0b3c00ff3c53818110484f9e295523a0c3c7f324 (patch) | |
tree | 74d2f5fc03fa6828aa63d847451310b2fae89536 /libgo/go | |
parent | 8db7a05fd73be5df9195a3697248084d4a5b0ee6 (diff) | |
download | gcc-0b3c00ff3c53818110484f9e295523a0c3c7f324.zip gcc-0b3c00ff3c53818110484f9e295523a0c3c7f324.tar.gz gcc-0b3c00ff3c53818110484f9e295523a0c3c7f324.tar.bz2 |
Make std::match_results::_M_resize more useful
As both callers of match_results::_M_resize(unsigned) immediately follow
it with a loop to update the value of each sub_match, that behaviour can
be moved into _M_resize itself. The first caller fills the container
with unmatched subs, which can be done with vector::assign, and the
second caller clears the container to establish a specific state, which
can be provided by a new member function specific to that purpose.
Tangentially, I also noticed that match_results::max_size() doesn't
account for the three special sub_match objects that are always present
in a fully established result state. This patch also fixes that.
* 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.
From-SVN: r271167
Diffstat (limited to 'libgo/go')
0 files changed, 0 insertions, 0 deletions