Regex: use std::conditional instead of custom template class to choose Utf8It

This commit is contained in:
Maxime Coste 2017-10-08 19:56:03 +08:00
parent db06acdfab
commit b8cb65160a

View File

@ -85,18 +85,6 @@ enum class RegexExecFlags
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>
class ThreadedRegexVM
{
@ -217,7 +205,9 @@ private:
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 };