diff options
author | B. Stack <bgstack15@gmail.com> | 2022-09-07 18:49:36 +0000 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-09-07 18:49:36 +0000 |
commit | 62bcefb8b809a32c6d26ab04ca686578bba5567a (patch) | |
tree | fbc1dea58a6b28f1af4a9e9b2bc8e3e1d23b2103 /zen/string_base.h | |
parent | Merge branch 'b11.23' into 'master' (diff) | |
parent | add upstream 11.24 (diff) | |
download | FreeFileSync-11.24.tar.gz FreeFileSync-11.24.tar.bz2 FreeFileSync-11.24.zip |
Merge branch 'b11.24' into 'master'11.24
add upstream 11.24
See merge request opensource-tracking/FreeFileSync!47
Diffstat (limited to 'zen/string_base.h')
-rw-r--r-- | zen/string_base.h | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/zen/string_base.h b/zen/string_base.h index ace870b9..e18a0f16 100644 --- a/zen/string_base.h +++ b/zen/string_base.h @@ -312,9 +312,10 @@ template <class Char, template <class> class SP> bool operator==(const Zb template <class Char, template <class> class SP> bool operator==(const Zbase<Char, SP>& lhs, const Char* rhs); template <class Char, template <class> class SP> inline bool operator==(const Char* lhs, const Zbase<Char, SP>& rhs) { return operator==(rhs, lhs); } -template <class Char, template <class> class SP> std::strong_ordering operator<=>(const Zbase<Char, SP>& lhs, const Zbase<Char, SP>& rhs); -template <class Char, template <class> class SP> std::strong_ordering operator<=>(const Zbase<Char, SP>& lhs, const Char* rhs); -template <class Char, template <class> class SP> std::strong_ordering operator<=>(const Char* lhs, const Zbase<Char, SP>& rhs); +//follow convention + compare by unsigned char; alternative: std::lexicographical_compare_three_way + reinterpret_cast<const std::make_unsigned_t<Char>*>() +template <class Char, template <class> class SP> std::strong_ordering operator<=>(const Zbase<Char, SP>& lhs, const Zbase<Char, SP>& rhs) { return compareString(lhs, rhs); } +template <class Char, template <class> class SP> std::strong_ordering operator<=>(const Zbase<Char, SP>& lhs, const Char* rhs) { return compareString(lhs, rhs); } +template <class Char, template <class> class SP> std::strong_ordering operator<=>(const Char* lhs, const Zbase<Char, SP>& rhs) { return compareString(lhs, rhs); } template <class Char, template <class> class SP> inline Zbase<Char, SP> operator+(const Zbase<Char, SP>& lhs, const Zbase<Char, SP>& rhs) { return Zbase<Char, SP>(lhs) += rhs; } template <class Char, template <class> class SP> inline Zbase<Char, SP> operator+(const Zbase<Char, SP>& lhs, const Char* rhs) { return Zbase<Char, SP>(lhs) += rhs; } @@ -495,30 +496,6 @@ bool operator==(const Zbase<Char, SP>& lhs, const Char* rhs) template <class Char, template <class> class SP> inline -std::strong_ordering operator<=>(const Zbase<Char, SP>& lhs, const Zbase<Char, SP>& rhs) -{ - return std::lexicographical_compare_three_way(lhs.begin(), lhs.end(), //respect embedded 0 - rhs.begin(), rhs.end()); // -} - - -template <class Char, template <class> class SP> inline -std::strong_ordering operator<=>(const Zbase<Char, SP>& lhs, const Char* rhs) -{ - return std::lexicographical_compare_three_way(lhs.begin(), lhs.end(), //respect embedded 0 - rhs, rhs + strLength(rhs)); -} - - -template <class Char, template <class> class SP> inline -std::strong_ordering operator<=>(const Char* lhs, const Zbase<Char, SP>& rhs) -{ - return std::lexicographical_compare_three_way(lhs, lhs + strLength(lhs), - rhs.begin(), rhs.end()); //respect embedded 0 -} - - -template <class Char, template <class> class SP> inline size_t Zbase<Char, SP>::length() const { return SP<Char>::length(rawStr_); |