Test whether the sum of two integers would overflow.
Synopsis
Declared in <util/overflow.h>
template<std::integral T>
[[nodiscard]]
bool
AdditionOverflow(
T const i,
T const j) noexcept;
Return Value
true if i + j would fall outside the representable range of T, false otherwise.
|
Note
|
The return value should not be discarded. |
Parameters
Name |
Description |
i |
The first addend. |
j |
The second addend. |
Created with MrDocs