include/o3tl/strong_int.hxx |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 98e4c241e9ef918c739638154b7ba850d70e0eed
Author: Michael Stahl <[email protected]>
Date:   Thu May 3 12:27:31 2018 +0200

    o3tl: add more strong_int operators
    
    Change-Id: Ibb0f883353b6d172275744eaa59d27ba39930623
    Reviewed-on: https://gerrit.libreoffice.org/55264
    Tested-by: Jenkins <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>

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
 
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to