summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/comphelper/errcode.hxx8
-rw-r--r--include/o3tl/strong_int.hxx9
2 files changed, 5 insertions, 12 deletions
diff --git a/include/comphelper/errcode.hxx b/include/comphelper/errcode.hxx
index 000f2c761da9..31c4457db4b5 100644
--- a/include/comphelper/errcode.hxx
+++ b/include/comphelper/errcode.hxx
@@ -24,6 +24,7 @@
#include <ostream>
#include <o3tl/typed_flags_set.hxx>
#include <optional>
+#include <compare>
#if defined(DBG_UTIL)
#if __has_include(<version>)
@@ -94,12 +95,7 @@ public:
explicit operator sal_uInt32() const { return m_value; }
explicit operator bool() const { return m_value != 0; }
- bool operator<(ErrCode const & other) const { return m_value < other.m_value; }
- bool operator<=(ErrCode const & other) const { return m_value <= other.m_value; }
- bool operator>(ErrCode const & other) const { return m_value > other.m_value; }
- bool operator>=(ErrCode const & other) const { return m_value >= other.m_value; }
- bool operator==(ErrCode const & other) const { return m_value == other.m_value; }
- bool operator!=(ErrCode const & other) const { return m_value != other.m_value; }
+ auto operator<=>(ErrCode const & other) const = default;
/** convert to ERRCODE_NONE if it's a warning, else return the error */
ErrCode IgnoreWarning() const {
diff --git a/include/o3tl/strong_int.hxx b/include/o3tl/strong_int.hxx
index 82107955897f..fd7a9abb9c52 100644
--- a/include/o3tl/strong_int.hxx
+++ b/include/o3tl/strong_int.hxx
@@ -24,6 +24,7 @@
#include <limits>
#include <cassert>
#include <type_traits>
+#include <compare>
namespace o3tl
{
@@ -100,12 +101,8 @@ public:
explicit operator bool() const { return m_value != 0; }
UNDERLYING_TYPE get() const { return m_value; }
- bool operator<(strong_int const & other) const { return m_value < other.m_value; }
- bool operator<=(strong_int const & other) const { return m_value <= other.m_value; }
- bool operator>(strong_int const & other) const { return m_value > other.m_value; }
- bool operator>=(strong_int const & other) const { return m_value >= other.m_value; }
- bool operator==(strong_int const & other) const { return m_value == other.m_value; }
- bool operator!=(strong_int const & other) const { return m_value != other.m_value; }
+ auto operator<=>(strong_int const & other) const = default;
+
strong_int& operator++() { ++m_value; return *this; }
strong_int operator++(int) { UNDERLYING_TYPE nOldValue = m_value; ++m_value; return strong_int(nOldValue); }
strong_int& operator--() { --m_value; return *this; }