Regex: use std::conditional instead of custom template class to choose Utf8It
This commit is contained in:
parent
db06acdfab
commit
b8cb65160a
|
@ -85,18 +85,6 @@ enum class RegexExecFlags
|
||||||
|
|
||||||
constexpr bool with_bit_ops(Meta::Type<RegexExecFlags>) { return true; }
|
constexpr bool with_bit_ops(Meta::Type<RegexExecFlags>) { return true; }
|
||||||
|
|
||||||
template<typename Iterator, MatchDirection direction>
|
|
||||||
struct ChooseUtf8It
|
|
||||||
{
|
|
||||||
using Type = utf8::iterator<Iterator>;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename Iterator>
|
|
||||||
struct ChooseUtf8It<Iterator, MatchDirection::Backward>
|
|
||||||
{
|
|
||||||
using Type = std::reverse_iterator<utf8::iterator<Iterator>>;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename Iterator, MatchDirection direction>
|
template<typename Iterator, MatchDirection direction>
|
||||||
class ThreadedRegexVM
|
class ThreadedRegexVM
|
||||||
{
|
{
|
||||||
|
@ -217,7 +205,9 @@ private:
|
||||||
Saves* saves;
|
Saves* saves;
|
||||||
};
|
};
|
||||||
|
|
||||||
using Utf8It = typename ChooseUtf8It<Iterator, direction>::Type;
|
using Utf8It = std::conditional_t<direction == MatchDirection::Forward,
|
||||||
|
utf8::iterator<Iterator>,
|
||||||
|
std::reverse_iterator<utf8::iterator<Iterator>>>;
|
||||||
|
|
||||||
enum class StepResult { Consumed, Matched, Failed };
|
enum class StepResult { Consumed, Matched, Failed };
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user