diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-05-03 12:27:31 +0200 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-06-04 11:53:39 +0200 |
commit | 98e4c241e9ef918c739638154b7ba850d70e0eed (patch) | |
tree | d2c60a3f7721f88c92cb2c695eff134ab3c51e3d /include/o3tl | |
parent | 57d598a276ea05a22c766587baa48b1685b7aafc (diff) |
o3tl: add more strong_int operators
Change-Id: Ibb0f883353b6d172275744eaa59d27ba39930623
Reviewed-on: https://gerrit.libreoffice.org/55264
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'include/o3tl')
-rw-r--r-- | include/o3tl/strong_int.hxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/o3tl/strong_int.hxx b/include/o3tl/strong_int.hxx index bdb60b30fb69..fb00addfad08 100644 --- a/include/o3tl/strong_int.hxx +++ b/include/o3tl/strong_int.hxx @@ -110,6 +110,10 @@ public: bool operator!=(strong_int const & other) const { return m_value != other.m_value; } 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; } + strong_int operator--(int) { UNDERLYING_TYPE nOldValue = m_value; --m_value; return strong_int(nOldValue); } + strong_int& operator+=(strong_int const & other) { m_value += other.m_value; return *this; } + strong_int& operator-=(strong_int const & other) { m_value -= other.m_value; return *this; } bool anyOf(strong_int v) const { return *this == v; @@ -130,6 +134,11 @@ strong_int<UT,PT> operator+(strong_int<UT,PT> const & lhs, strong_int<UT,PT> con return strong_int<UT,PT>(lhs.get() + rhs.get()); } +template <typename UT, typename PT> +strong_int<UT,PT> operator-(strong_int<UT,PT> const & lhs, strong_int<UT,PT> const & rhs) +{ + return strong_int<UT,PT>(lhs.get() - rhs.get()); +} }; // namespace o3tl |