diff options
author | B Stack <bgstack15@gmail.com> | 2020-05-17 11:17:28 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2020-05-17 11:17:28 -0400 |
commit | f0f3f094c5fa05bafe1963d1ea13f1be39a6673b (patch) | |
tree | 1f52055b2f26fc2389d3ab4eb8d8d1e234a6316a /zen/string_base.h | |
parent | Merge branch '10.23' into 'master' (diff) | |
download | FreeFileSync-f0f3f094c5fa05bafe1963d1ea13f1be39a6673b.tar.gz FreeFileSync-f0f3f094c5fa05bafe1963d1ea13f1be39a6673b.tar.bz2 FreeFileSync-f0f3f094c5fa05bafe1963d1ea13f1be39a6673b.zip |
add upstream 10.24
Diffstat (limited to 'zen/string_base.h')
-rw-r--r-- | zen/string_base.h | 49 |
1 files changed, 4 insertions, 45 deletions
diff --git a/zen/string_base.h b/zen/string_base.h index 5922c3ff..58e5d43a 100644 --- a/zen/string_base.h +++ b/zen/string_base.h @@ -12,9 +12,7 @@ #include <cstdint> #include <atomic> #include "string_tools.h" -#if __cpp_impl_three_way_comparison && __cpp_lib_three_way_comparison #include <compare> -#endif //Zbase - a policy based string class optimizing performance and flexibility @@ -295,29 +293,15 @@ private: }; -#if __cpp_impl_three_way_comparison && __cpp_lib_three_way_comparison - #error implement! -#endif - template <class Char, template <class> class SP> bool operator==(const Zbase<Char, SP>& lhs, const Zbase<Char, SP>& rhs); 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); } -#if __cpp_impl_three_way_comparison && __cpp_lib_three_way_comparison 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); -#else -template <class Char, template <class> class SP> inline bool operator!=(const Zbase<Char, SP>& lhs, const Zbase<Char, SP>& rhs) { return !operator==(lhs, rhs); } -template <class Char, template <class> class SP> inline bool operator!=(const Zbase<Char, SP>& lhs, const Char* rhs) { return !operator==(lhs, rhs); } -template <class Char, template <class> class SP> inline bool operator!=(const Char* lhs, const Zbase<Char, SP>& rhs) { return !operator==(lhs, rhs); } - -template <class Char, template <class> class SP> bool operator<(const Zbase<Char, SP>& lhs, const Zbase<Char, SP>& rhs); -template <class Char, template <class> class SP> bool operator<(const Zbase<Char, SP>& lhs, const Char* rhs); -template <class Char, template <class> class SP> bool operator<(const Char* lhs, const Zbase<Char, SP>& rhs); -#endif 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; } @@ -498,12 +482,11 @@ bool operator==(const Zbase<Char, SP>& lhs, const Char* rhs) } -#if __cpp_impl_three_way_comparison && __cpp_lib_three_way_comparison 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()); + return std::lexicographical_compare_three_way(lhs.begin(), lhs.end(), //respect embedded 0 + rhs.begin(), rhs.end()); // } @@ -518,35 +501,11 @@ std::strong_ordering operator<=>(const Zbase<Char, SP>& lhs, const Char* 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), //respect embedded 0 - rhs.begin(), rhs.end()); -} - -#else -template <class Char, template <class> class SP> inline -bool operator<(const Zbase<Char, SP>& lhs, const Zbase<Char, SP>& rhs) -{ - return std::lexicographical_compare(lhs.begin(), lhs.end(), //respect embedded 0 - rhs.begin(), rhs.end()); -} - - -template <class Char, template <class> class SP> inline -bool operator<(const Zbase<Char, SP>& lhs, const Char* rhs) -{ - return std::lexicographical_compare(lhs.begin(), lhs.end(), //respect embedded 0 - rhs, rhs + strLength(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 -bool operator<(const Char* lhs, const Zbase<Char, SP>& rhs) -{ - return std::lexicographical_compare(lhs, lhs + strLength(lhs), //respect embedded 0 - rhs.begin(), rhs.end()); -} -#endif - template <class Char, template <class> class SP> inline size_t Zbase<Char, SP>::length() const |