Explicitly instantiate matchee std::string in MatchesRegex

If this ever turns out to be a performance issue, we could use std::conditional and std::is_same to avoid copying std::strings.

Fixes #3949

PiperOrigin-RevId: 465353572
Change-Id: If2d691bccb626c692c87e006df5afe88a4ed1542
This commit is contained in:
Dino Radakovic 2022-08-04 10:53:26 -07:00 committed by Copybara-Service
parent 6045bf2ade
commit 5b909beeec

View file

@ -842,7 +842,7 @@ class MatchesRegexMatcher {
template <class MatcheeStringType>
bool MatchAndExplain(const MatcheeStringType& s,
MatchResultListener* /* listener */) const {
const std::string& s2(s);
const std::string s2(s);
return full_match_ ? RE::FullMatch(s2, *regex_)
: RE::PartialMatch(s2, *regex_);
}