From 47c88c433d17948fab1d8e1d76121a72fe5938cb Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Wed, 7 Sep 2022 14:49:22 -0400 Subject: add upstream 11.24 --- zen/string_base.h | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) (limited to 'zen/string_base.h') 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 SP> bool operator==(const Zb template class SP> bool operator==(const Zbase& lhs, const Char* rhs); template class SP> inline bool operator==(const Char* lhs, const Zbase& rhs) { return operator==(rhs, lhs); } -template class SP> std::strong_ordering operator<=>(const Zbase& lhs, const Zbase& rhs); -template class SP> std::strong_ordering operator<=>(const Zbase& lhs, const Char* rhs); -template class SP> std::strong_ordering operator<=>(const Char* lhs, const Zbase& rhs); +//follow convention + compare by unsigned char; alternative: std::lexicographical_compare_three_way + reinterpret_cast*>() +template class SP> std::strong_ordering operator<=>(const Zbase& lhs, const Zbase& rhs) { return compareString(lhs, rhs); } +template class SP> std::strong_ordering operator<=>(const Zbase& lhs, const Char* rhs) { return compareString(lhs, rhs); } +template class SP> std::strong_ordering operator<=>(const Char* lhs, const Zbase& rhs) { return compareString(lhs, rhs); } template class SP> inline Zbase operator+(const Zbase& lhs, const Zbase& rhs) { return Zbase(lhs) += rhs; } template class SP> inline Zbase operator+(const Zbase& lhs, const Char* rhs) { return Zbase(lhs) += rhs; } @@ -494,30 +495,6 @@ bool operator==(const Zbase& lhs, const Char* rhs) } -template class SP> inline -std::strong_ordering operator<=>(const Zbase& lhs, const Zbase& rhs) -{ - return std::lexicographical_compare_three_way(lhs.begin(), lhs.end(), //respect embedded 0 - rhs.begin(), rhs.end()); // -} - - -template class SP> inline -std::strong_ordering operator<=>(const Zbase& lhs, const Char* rhs) -{ - return std::lexicographical_compare_three_way(lhs.begin(), lhs.end(), //respect embedded 0 - rhs, rhs + strLength(rhs)); -} - - -template class SP> inline -std::strong_ordering operator<=>(const Char* lhs, const Zbase& rhs) -{ - return std::lexicographical_compare_three_way(lhs, lhs + strLength(lhs), - rhs.begin(), rhs.end()); //respect embedded 0 -} - - template class SP> inline size_t Zbase::length() const { -- cgit