Add minus operator to AllocationData
authorMilian Wolff <mail@milianw.de>
Tue, 31 May 2016 22:06:02 +0000 (00:06 +0200)
committerMilian Wolff <mail@milianw.de>
Sun, 12 Jun 2016 20:25:15 +0000 (22:25 +0200)
allocationdata.h

index 4938af8..34b3012 100644 (file)
@@ -46,9 +46,24 @@ inline AllocationData& operator+=(AllocationData& lhs, const AllocationData& rhs
     return lhs;
 }
 
+inline AllocationData& operator-=(AllocationData& lhs, const AllocationData& rhs)
+{
+    lhs.allocations -= rhs.allocations;
+    lhs.temporary -= rhs.temporary;
+    lhs.peak -= rhs.peak;
+    lhs.leaked -= rhs.leaked;
+    lhs.allocated -= rhs.allocated;
+    return lhs;
+}
+
 inline AllocationData operator+(AllocationData lhs, const AllocationData& rhs)
 {
     return lhs += rhs;
 }
 
+inline AllocationData operator-(AllocationData lhs, const AllocationData& rhs)
+{
+    return lhs -= rhs;
+}
+
 #endif // ALLOCATIONDATA_H