Code style tweak for Regex implementation TestVM

This commit is contained in:
Maxime Coste 2021-07-31 08:55:52 +10:00
parent 52087a506d
commit b57dc7c512

View File

@ -1241,17 +1241,14 @@ namespace
template<RegexMode mode = RegexMode::Forward>
struct TestVM : CompiledRegex, ThreadedRegexVM<const char*, mode>
{
using VMType = ThreadedRegexVM<const char*, mode>;
TestVM(StringView re, bool dump = false)
: CompiledRegex{compile_regex(re, mode & RegexMode::Forward ?
RegexCompileFlags::None : RegexCompileFlags::Backward)},
VMType{(const CompiledRegex&)*this}
{ if (dump) puts(dump_regex(*this).c_str()); }
TestVM(StringView re)
: CompiledRegex{compile_regex(re, mode & RegexMode::Forward ? RegexCompileFlags::None : RegexCompileFlags::Backward)},
TestVM::ThreadedRegexVM{static_cast<const CompiledRegex&>(*this)}
{}
bool exec(StringView re, RegexExecFlags flags = RegexExecFlags::None)
{
return VMType::exec(re.begin(), re.end(), re.begin(), re.end(), flags);
return TestVM::ThreadedRegexVM::exec(re.begin(), re.end(), re.begin(), re.end(), flags);
}
};
}