[#CheckedAdd]
= CheckedAdd
:mrdocs:

Add two integers, checking for overflow&period;

== Synopsis

Declared in `&lt;util&sol;overflow&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class T&gt;
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
std::optional&lt;T&gt;
CheckedAdd(
    T const i,
    T const j) noexcept;
----

== Return Value

The sum `i &plus; j`, or std&colon;&colon;nullopt if the addition would overflow T&period;

[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&period;
| *j*
| The second addend&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
