plutolove’s diary

I love three things in this world, the sun, the moon and you. The sun for the day, the moon for the night, and you forever。

Entries from 2021-11-01 to 1 month

C++ 模板类型推导

C++

以下列代码为例子,当调用func(expr)时,编译器会自动推导出来T的类型和ParamType的类型,模板类型推导分为一下三种类型: template<typename T> void func(ParamType p); 当ParamType是指针或者引用类型,并且不是通用引用类型 ,如果expr的类型是引用类型,丢掉其引用</typename>…