[#SaturatingAdd] = SaturatingAdd :mrdocs: Add two integers, saturating instead of overflowing. == Synopsis Declared in `<util/overflow.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::integral T> [[nodiscard]] T SaturatingAdd( T const i, T const j) noexcept; ---- == Return Value The sum `i + j`, clamped to the lowest or highest representable value of T when the addition would overflow. [NOTE] ==== The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^]. ==== == Parameters [cols="1,4"] |=== | Name| Description | *i* | The first addend. | *j* | The second addend. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#