From a6c1c6c7aebe9a37eaf75c78e59d0f4a24098e7a Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Tue, 4 Jul 2023 11:08:30 +0200 Subject: [PATCH] interval: Add equality operators MSVC is not comparing instances properly otherwise. Signed-off-by: Simon Rozman --- include/stdex/interval.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/stdex/interval.hpp b/include/stdex/interval.hpp index ddb84b0b2..5e35f5a98 100644 --- a/include/stdex/interval.hpp +++ b/include/stdex/interval.hpp @@ -59,6 +59,24 @@ namespace stdex /// \returns true if interval is valid or false otherwise /// inline operator bool() const { return start <= end; } + + /// + /// Are intervals identical? + /// + /// \param[in] other Other interval to compare against + /// + /// \returns true if intervals are identical or false otherwise + /// + inline bool operator==(const interval& other) const { return start == other.start && end == other.end; } + + /// + /// Are intervals different? + /// + /// \param[in] other Other interval to compare against + /// + /// \returns true if intervals are different or false otherwise + /// + inline bool operator!=(const interval& other) const { return !operator==(other); } }; template >>