[#CheckedAdd] = CheckedAdd :mrdocs: Add two integers, checking for overflow. == Synopsis Declared in `<util/overflow.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> [[nodiscard]] std::optional<T> CheckedAdd( T const i, T const j) noexcept; ---- == Return Value The sum `i + j`, or std::nullopt if the addition would overflow T. [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]#