数组在c语言里传给函数后,会退化成指针,这个时候需要借助模板
template<typename T,int TS>
void printX(T (&x)[TS])//not T[Ts] &x
{
printf("%d", TS);
}
数组在c语言里传给函数后,会退化成指针,这个时候需要借助模板
template<typename T,int TS>
void printX(T (&x)[TS])//not T[Ts] &x
{
printf("%d", TS);
}
转载于:https://www.cnblogs.com/lsaejn/p/9870012.html