summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-10-08 19:56:03 +0800
committerMaxime Coste <mawww@kakoune.org>2017-11-01 14:05:14 +0800
commitb8cb65160acec9531c00b2066a8a574cac1645e6 (patch)
tree5a6f1c832ce99bbd3ebd603f1e1735cd4916c74d /src
parentdb06acdfab918e12f9d5a17d18b5fac766613e3f (diff)
Regex: use std::conditional instead of custom template class to choose Utf8It
Diffstat (limited to 'src')
-rw-r--r--src/regex_impl.hh16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/regex_impl.hh b/src/regex_impl.hh
index 5a294400..3addb2b2 100644
--- a/src/regex_impl.hh
+++ b/src/regex_impl.hh
@@ -86,18 +86,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
{
public:
@@ -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 };