Skip to content

Commit e3d95c7

Browse files
author
Hana Dusíková
committed
Merge commit 'a947f4fff910336a93db81e417b27c776f897875' into multiline
# Conflicts: # include/ctre/utf8.hpp # single-header/ctre-unicode.hpp # single-header/ctre.hpp
2 parents 344baf2 + a947f4f commit e3d95c7

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

include/ctre/evaluation.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@ template <typename Iterator> struct string_match_result {
108108
};
109109

110110
template <typename CharT, typename Iterator, typename EndIterator> constexpr CTRE_FORCE_INLINE bool compare_character(CharT c, Iterator & it, const EndIterator & end) {
111-
bool same = ((it != end) && (*it == c));
112-
++it;
113-
return same;
111+
if (it != end) {
112+
return *it++ == c;
113+
}
114+
return false;
114115
}
115116

116117
template <auto... String, size_t... Idx, typename Iterator, typename EndIterator> constexpr CTRE_FORCE_INLINE string_match_result<Iterator> evaluate_match_string(Iterator current, [[maybe_unused]] const EndIterator end, std::index_sequence<Idx...>) noexcept {

single-header/ctre-unicode.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4026,9 +4026,10 @@ template <typename Iterator> struct string_match_result {
40264026
};
40274027

40284028
template <typename CharT, typename Iterator, typename EndIterator> constexpr CTRE_FORCE_INLINE bool compare_character(CharT c, Iterator & it, const EndIterator & end) {
4029-
bool same = ((it != end) && (*it == c));
4030-
++it;
4031-
return same;
4029+
if (it != end) {
4030+
return *it++ == c;
4031+
}
4032+
return false;
40324033
}
40334034

40344035
template <auto... String, size_t... Idx, typename Iterator, typename EndIterator> constexpr CTRE_FORCE_INLINE string_match_result<Iterator> evaluate_match_string(Iterator current, [[maybe_unused]] const EndIterator end, std::index_sequence<Idx...>) noexcept {

single-header/ctre.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4023,9 +4023,10 @@ template <typename Iterator> struct string_match_result {
40234023
};
40244024

40254025
template <typename CharT, typename Iterator, typename EndIterator> constexpr CTRE_FORCE_INLINE bool compare_character(CharT c, Iterator & it, const EndIterator & end) {
4026-
bool same = ((it != end) && (*it == c));
4027-
++it;
4028-
return same;
4026+
if (it != end) {
4027+
return *it++ == c;
4028+
}
4029+
return false;
40294030
}
40304031

40314032
template <auto... String, size_t... Idx, typename Iterator, typename EndIterator> constexpr CTRE_FORCE_INLINE string_match_result<Iterator> evaluate_match_string(Iterator current, [[maybe_unused]] const EndIterator end, std::index_sequence<Idx...>) noexcept {

0 commit comments

Comments
 (0)