Subtract j from i in place, only if it does not underflow.
Synopsis
Declared in <util/overflow.h>
template<
std::unsigned_integral T,
std::unsigned_integral U>
[[nodiscard]]
constexpr
bool
TrySub(
T& i,
U const j) noexcept;
Return Value
true if i >= j and the subtraction was applied, false if it was left unchanged.
|
Note
|
The return value should not be discarded. |
Parameters
Name |
Description |
i |
The minuend, updated to |
j |
The amount to subtract. |
Created with MrDocs