add_lvalue_reference【免费下载链接】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 推理系列产品√功能说明在程序编译时为指定类型添加左值引用限定符可以用于在编译时进行类型转换。函数原型template typename Tp struct add_lvalue_reference;参数说明表 1模板参数说明参数名含义Tp需要处理的类型包括基本类型如int、float等、复合类型如数组、指针、用户自定义类型如类、结构体等以及带有引用限定符的类型。约束说明无返回值说明add_lvalue_reference是一个结构体其提供一个嵌套类型type表示添加左值引用限定符后的类型。通过add_lvalue_referenceTp::type来访问该类型。调用示例// Test basic type ascendc_assert((AscendC::Std::is_same_vAscendC::Std::add_lvalue_reference_tint, int)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::add_lvalue_reference_tfloat, float)); // Test pointer type ascendc_assert((AscendC::Std::is_same_vAscendC::Std::add_lvalue_reference_tint*, int*)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::add_lvalue_reference_tconst int*, const int*)); // Test reference type ascendc_assert((AscendC::Std::is_same_vAscendC::Std::add_lvalue_reference_tint, int)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::add_lvalue_reference_tint, int)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::add_lvalue_reference_tconst int, const int)); // Test void type ascendc_assert((AscendC::Std::is_same_vAscendC::Std::add_lvalue_reference_tvoid, void)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::add_lvalue_reference_tconst void, const void)); // Test function type using FuncType void(); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::add_lvalue_reference_tFuncType, FuncType)); // Test array type using ArrayType int[]; ascendc_assert((AscendC::Std::is_same_vAscendC::Std::add_lvalue_reference_tArrayType, ArrayType)); // Test class type class MyClass {}; ascendc_assert((AscendC::Std::is_same_vAscendC::Std::add_lvalue_reference_tMyClass, MyClass)); ascendc_assert((AscendC::Std::is_same_vAscendC::Std::add_lvalue_reference_tconst MyClass, const MyClass));【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考