remove_const【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit产品支持情况产品是否支持Ascend 950PR/Ascend 950DT√Atlas A3 训练系列产品 / Atlas A3 推理系列产品√Atlas A2 训练系列产品 / Atlas A2 推理系列产品√Atlas 200I/500 A2 推理产品xAtlas 推理系列产品 AI CorexAtlas 推理系列产品 Vector CorexAtlas 训练系列产品x功能说明在程序编译时对传入的模板参数类型移除const限定符可以用于在编译时进行类型转换。函数原型template typename Tp struct remove_const;参数说明表 1模板参数说明参数名含义Tp需要处理的类型包括基本类型如int、float等、复合类型如数组、指针、引用、用户自定义类型如类、结构体等以及const限定的类型。约束说明无返回值说明remove_const是一个结构体其提供一个嵌套类型type表示移除const限定符后的类型。通过remove_constTp::type来访问该类型。调用示例// Test non-const type ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_constint::type, int)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_constdouble::type, double)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_constchar::type, char)); // Test const type ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_constconst int::type, int)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_constconst double::type, double)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_constconst char::type, char)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_const_tint, int)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_const_tdouble, double)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_const_tconst int, int)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_const_tconst double, double));【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
CANN/asc-devkit remove_const类型特性
remove_const【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit产品支持情况产品是否支持Ascend 950PR/Ascend 950DT√Atlas A3 训练系列产品 / Atlas A3 推理系列产品√Atlas A2 训练系列产品 / Atlas A2 推理系列产品√Atlas 200I/500 A2 推理产品xAtlas 推理系列产品 AI CorexAtlas 推理系列产品 Vector CorexAtlas 训练系列产品x功能说明在程序编译时对传入的模板参数类型移除const限定符可以用于在编译时进行类型转换。函数原型template typename Tp struct remove_const;参数说明表 1模板参数说明参数名含义Tp需要处理的类型包括基本类型如int、float等、复合类型如数组、指针、引用、用户自定义类型如类、结构体等以及const限定的类型。约束说明无返回值说明remove_const是一个结构体其提供一个嵌套类型type表示移除const限定符后的类型。通过remove_constTp::type来访问该类型。调用示例// Test non-const type ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_constint::type, int)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_constdouble::type, double)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_constchar::type, char)); // Test const type ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_constconst int::type, int)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_constconst double::type, double)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_constconst char::type, char)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_const_tint, int)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_const_tdouble, double)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_const_tconst int, int)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::remove_const_tconst double, double));【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考