diff options
author | B. Stack <bgstack15@gmail.com> | 2022-09-07 14:49:22 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-09-07 14:49:22 -0400 |
commit | 47c88c433d17948fab1d8e1d76121a72fe5938cb (patch) | |
tree | fbc1dea58a6b28f1af4a9e9b2bc8e3e1d23b2103 /zen/string_base.h | |
parent | Merge branch 'b11.23' into 'master' (diff) | |
download | FreeFileSync-47c88c433d17948fab1d8e1d76121a72fe5938cb.tar.gz FreeFileSync-47c88c433d17948fab1d8e1d76121a72fe5938cb.tar.bz2 FreeFileSync-47c88c433d17948fab1d8e1d76121a72fe5938cb.zip |
add upstream 11.24
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_); |