Skip to content

Commit a9418a5

Browse files
committed
selection of proper comparsion functions was problematic in MSVC and due multiple options it failed (fix for #338)
1 parent 6de31ef commit a9418a5

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

include/ctre/utf8.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,11 @@ struct utf8_iterator {
4343
friend constexpr auto operator==(self_type, const char8_t * other_ptr) noexcept {
4444
return *other_ptr == char8_t{0};
4545
}
46-
46+
#if __cpp_impl_three_way_comparison < 201907L
4747
friend constexpr auto operator!=(self_type, const char8_t * other_ptr) noexcept {
4848
return *other_ptr != char8_t{0};
4949
}
5050

51-
#if __cpp_impl_three_way_comparison < 201907L
5251
friend constexpr auto operator==(const char8_t * other_ptr, self_type) noexcept {
5352
return *other_ptr == char8_t{0};
5453
}
@@ -61,7 +60,7 @@ struct utf8_iterator {
6160

6261
const char8_t * ptr{nullptr};
6362
const char8_t * end{nullptr};
64-
63+
#if __cpp_impl_three_way_comparison < 201907L
6564
constexpr friend bool operator!=(const utf8_iterator & lhs, sentinel) {
6665
return lhs.ptr < lhs.end;
6766
}
@@ -73,7 +72,7 @@ struct utf8_iterator {
7372
constexpr friend bool operator!=(const utf8_iterator & lhs, const utf8_iterator & rhs) {
7473
return lhs.ptr != rhs.ptr;
7574
}
76-
75+
#endif
7776
constexpr friend bool operator==(const utf8_iterator & lhs, sentinel) {
7877
return lhs.ptr >= lhs.end;
7978
}

single-header/ctre-unicode.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3125,12 +3125,11 @@ struct utf8_iterator {
31253125
friend constexpr auto operator==(self_type, const char8_t * other_ptr) noexcept {
31263126
return *other_ptr == char8_t{0};
31273127
}
3128-
3128+
#if __cpp_impl_three_way_comparison < 201907L
31293129
friend constexpr auto operator!=(self_type, const char8_t * other_ptr) noexcept {
31303130
return *other_ptr != char8_t{0};
31313131
}
31323132

3133-
#if __cpp_impl_three_way_comparison < 201907L
31343133
friend constexpr auto operator==(const char8_t * other_ptr, self_type) noexcept {
31353134
return *other_ptr == char8_t{0};
31363135
}
@@ -3143,7 +3142,7 @@ struct utf8_iterator {
31433142

31443143
const char8_t * ptr{nullptr};
31453144
const char8_t * end{nullptr};
3146-
3145+
#if __cpp_impl_three_way_comparison < 201907L
31473146
constexpr friend bool operator!=(const utf8_iterator & lhs, sentinel) {
31483147
return lhs.ptr < lhs.end;
31493148
}
@@ -3155,7 +3154,7 @@ struct utf8_iterator {
31553154
constexpr friend bool operator!=(const utf8_iterator & lhs, const utf8_iterator & rhs) {
31563155
return lhs.ptr != rhs.ptr;
31573156
}
3158-
3157+
#endif
31593158
constexpr friend bool operator==(const utf8_iterator & lhs, sentinel) {
31603159
return lhs.ptr >= lhs.end;
31613160
}

single-header/ctre.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3122,12 +3122,11 @@ struct utf8_iterator {
31223122
friend constexpr auto operator==(self_type, const char8_t * other_ptr) noexcept {
31233123
return *other_ptr == char8_t{0};
31243124
}
3125-
3125+
#if __cpp_impl_three_way_comparison < 201907L
31263126
friend constexpr auto operator!=(self_type, const char8_t * other_ptr) noexcept {
31273127
return *other_ptr != char8_t{0};
31283128
}
31293129

3130-
#if __cpp_impl_three_way_comparison < 201907L
31313130
friend constexpr auto operator==(const char8_t * other_ptr, self_type) noexcept {
31323131
return *other_ptr == char8_t{0};
31333132
}
@@ -3140,7 +3139,7 @@ struct utf8_iterator {
31403139

31413140
const char8_t * ptr{nullptr};
31423141
const char8_t * end{nullptr};
3143-
3142+
#if __cpp_impl_three_way_comparison < 201907L
31443143
constexpr friend bool operator!=(const utf8_iterator & lhs, sentinel) {
31453144
return lhs.ptr < lhs.end;
31463145
}
@@ -3152,7 +3151,7 @@ struct utf8_iterator {
31523151
constexpr friend bool operator!=(const utf8_iterator & lhs, const utf8_iterator & rhs) {
31533152
return lhs.ptr != rhs.ptr;
31543153
}
3155-
3154+
#endif
31563155
constexpr friend bool operator==(const utf8_iterator & lhs, sentinel) {
31573156
return lhs.ptr >= lhs.end;
31583157
}

0 commit comments

Comments
 (0)