mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Add decrement operator to Checked
This commit is contained in:
parent
8688259ed9
commit
8a8bdb2cd7
Notes:
sideshowbarker
2024-07-18 21:25:26 +09:00
Author: https://github.com/tomuta Commit: https://github.com/SerenityOS/serenity/commit/8a8bdb2cd77 Pull-request: https://github.com/SerenityOS/serenity/pull/5740
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…
Reference in a new issue