mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:47:35 +00:00
AK: Add decrement operator to Checked
This commit is contained in:
parent
8688259ed9
commit
8a8bdb2cd7
1 changed files with 13 additions and 0 deletions
13
AK/Checked.h
13
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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue