Namespaces
Variants

Standard library header <stdckdint.h> (C++26)

From cppreference.net
Standard library headers

此头文件最初属于C标准库( <stdckdint.h> )。

此头文件是 数值运算库 的组成部分,特别提供了若干用于 受检整数算术运算 的函数模板。

未指定 <stdckdint.h> 是否在命名空间 std 中提供任何声明。

函数

(C++26)
对两个整数进行带检查的加法运算
(函数模板)
(C++26)
对两个整数进行带检查的减法运算
(函数模板)
(C++26)
对两个整数进行带检查的乘法运算
(函数模板)

概要

#define __STDC_VERSION_STDCKDINT_H__ 202311L
template<class type1, class type2, class type3>
bool ckd_add(type1* result, type2 a, type3 b);
template<class type2, class type3>
bool ckd_sub(type1* result, type2 a, type3 b);
template<class type1, class type2, class type3>
bool ckd_mul(type1* result, type2 a, type3 b);
(注:原文中第二段模板声明存在类型参数不一致问题,已保持原文未作修改)