diff options
| author | Dan Engelbrecht <[email protected]> | 2022-05-12 12:18:21 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-05-12 12:18:21 +0200 |
| commit | 0fc71fc55feb0bfa98c1e6a24f8d8485859dfc70 (patch) | |
| tree | 2515a259075a46745e71b62abfadee293eefe9c8 /zencore/include | |
| parent | Merge pull request #92 from EpicGames/de/bucket-standalone-temp-file-cleanup (diff) | |
| parent | use string::compare in caseSensitiveCompareStrings (diff) | |
| download | zen-actions_updates.tar.xz zen-actions_updates.zip | |
Merge pull request #93 from EpicGames/de/namespaces-continuedv1.0.1.7actions_updates
De/namespaces continued
Diffstat (limited to 'zencore/include')
| -rw-r--r-- | zencore/include/zencore/string.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/zencore/include/zencore/string.h b/zencore/include/zencore/string.h index 012ee73ee..92f567dae 100644 --- a/zencore/include/zencore/string.h +++ b/zencore/include/zencore/string.h @@ -9,6 +9,7 @@ #include <string.h> #include <charconv> #include <codecvt> +#include <compare> #include <concepts> #include <optional> #include <span> @@ -795,6 +796,21 @@ StrCaseCompare(const char* Lhs, const char* Rhs, int64_t Length = -1) #endif } +/** + * @brief + * Helper function to implement case sensitive spaceship operator for strings. + * MacOS clang version we use does not implement <=> for std::string + * @param Lhs string + * @param Rhs string + * @return std::strong_ordering indicating relationship between Lhs and Rhs + */ +inline auto +caseSensitiveCompareStrings(const std::string& Lhs, const std::string& Rhs) +{ + int r = Lhs.compare(Rhs); + return r == 0 ? std::strong_ordering::equal : r < 0 ? std::strong_ordering::less : std::strong_ordering::greater; +} + ////////////////////////////////////////////////////////////////////////// /** |