From eef6371ab48dacdab350530d38aa4fd57c32e4fc Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Thu, 26 Dec 2019 14:03:55 +0100 Subject: [PATCH] Missing fixed_string comparison operators added --- .../units/bits/external/fixed_string.h | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/include/units/bits/external/fixed_string.h b/src/include/units/bits/external/fixed_string.h index 0fe86f97..45fb5919 100644 --- a/src/include/units/bits/external/fixed_string.h +++ b/src/include/units/bits/external/fixed_string.h @@ -103,6 +103,11 @@ struct basic_fixed_string { return true; } + [[nodiscard]] constexpr friend bool operator!=(const basic_fixed_string& lhs, const basic_fixed_string& rhs) noexcept + { + return !(lhs == rhs); + } + template [[nodiscard]] constexpr friend bool operator==(const basic_fixed_string&, const basic_fixed_string&) noexcept @@ -110,6 +115,13 @@ struct basic_fixed_string { return false; } + template + [[nodiscard]] constexpr friend bool operator!=(const basic_fixed_string&, + const basic_fixed_string&) noexcept + { + return true; + } + template [[nodiscard]] constexpr friend bool operator<(const basic_fixed_string& lhs, const basic_fixed_string& rhs) noexcept @@ -127,6 +139,27 @@ struct basic_fixed_string { return first1 == last1 && first2 != last2; } + template + [[nodiscard]] constexpr friend bool operator>(const basic_fixed_string& lhs, + const basic_fixed_string& rhs) noexcept + { + return rhs < lhs; + } + + template + [[nodiscard]] constexpr friend bool operator<=(const basic_fixed_string& lhs, + const basic_fixed_string& rhs) noexcept + { + return !(rhs < lhs); + } + + template + [[nodiscard]] constexpr friend bool operator>=(const basic_fixed_string& lhs, + const basic_fixed_string& rhs) noexcept + { + return !(lhs < rhs); + } + #endif template