@@ -136,10 +136,15 @@ constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, c
136
136
// matching select in patterns
137
137
template <typename R, typename Iterator, typename EndIterator, typename HeadOptions, typename ... TailOptions, typename ... Tail>
138
138
constexpr CTRE_FORCE_INLINE R evaluate (const Iterator begin, Iterator current, const EndIterator end, const flags & f, R captures, ctll::list<select<HeadOptions, TailOptions...>, Tail...>) noexcept {
139
- if (auto r = evaluate (begin, current, end, f, captures, ctll::list<HeadOptions, Tail...>())) {
140
- return r;
139
+ if constexpr (MatchesCharacter<HeadOptions>::template value<decltype (*std::declval<Iterator>())> &&
140
+ ((MatchesCharacter<TailOptions>::template value<decltype (*std::declval<Iterator>())>) && ...)) {
141
+ return evaluate (begin, current, end, f, captures, ctll::list<set<HeadOptions, TailOptions...>, Tail...>());
141
142
} else {
142
- return evaluate (begin, current, end, f, captures, ctll::list<select <TailOptions...>, Tail...>());
143
+ if (auto r = evaluate (begin, current, end, f, captures, ctll::list<HeadOptions, Tail...>())) {
144
+ return r;
145
+ } else {
146
+ return evaluate (begin, current, end, f, captures, ctll::list<select <TailOptions...>, Tail...>());
147
+ }
143
148
}
144
149
}
145
150
0 commit comments