xte ::sub_checked ()
Defined in header <xte/math/sub_checked.hpp> Computes the difference (wrapped in
xte ::opt {}) of multiple values (subtracted sequentially). Returns xte ::null if the result of any intermediate operation cannot be represented.Definition
[[nodiscard ]]constexpr auto sub_checked (xte ::is_number auto augend ,xte ::is_number auto... addends )noexcept ;
Example
[View in Compiler Explorer]static_assert (*xte ::sub_checked (1 ,2 ) ==3 );static_assert (!xte ::sub_checked (INT_MAX ,1 ));