From 4910c1fdaa2ecab1ef56c8e162f431554d6547f2 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 3 Nov 2020 19:42:01 +0100 Subject: [PATCH] Fix string comparison in C++ --- api/sixtyfps-cpp/include/sixtyfps_string.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/api/sixtyfps-cpp/include/sixtyfps_string.h b/api/sixtyfps-cpp/include/sixtyfps_string.h index a013f3eae..35dc32c41 100644 --- a/api/sixtyfps-cpp/include/sixtyfps_string.h +++ b/api/sixtyfps-cpp/include/sixtyfps_string.h @@ -107,6 +107,15 @@ struct SharedString return std::string_view(a) != std::string_view(b); } + friend bool operator<(const SharedString &a, const SharedString &b) + { return std::string_view(a) < std::string_view(b); } + friend bool operator<=(const SharedString &a, const SharedString &b) + { return std::string_view(a) <= std::string_view(b); } + friend bool operator>(const SharedString &a, const SharedString &b) + { return std::string_view(a) > std::string_view(b); } + friend bool operator>=(const SharedString &a, const SharedString &b) + { return std::string_view(a) >= std::string_view(b); } + /// Writes the \a shared_string to the specified \a stream and returns a reference to the /// stream. friend std::ostream &operator<<(std::ostream &stream, const SharedString &shared_string)