summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
Diffstat (limited to 'AK')
-rw-r--r--AK/Checked.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/AK/Checked.h b/AK/Checked.h
index 3ed63f0132..eaeb1bc3f2 100644
--- a/AK/Checked.h
+++ b/AK/Checked.h
@@ -251,6 +251,19 @@ public:
return old;
}
+ constexpr Checked& operator--()
+ {
+ sub(1);
+ return *this;
+ }
+
+ constexpr Checked operator--(int)
+ {
+ Checked old { *this };
+ sub(1);
+ return old;
+ }
+
template<typename U, typename V>
static constexpr bool addition_would_overflow(U u, V v)
{