C++void f (std::array<int,3> a)可以省略数组大小吗?

如题所述

不可以省略数组大小,因为std::array模版参数个数为2。
同时,C++不认为std::array<int,3>与std::array<int,4>是相同类型。

此外,std::array作参数时,建议这样做:void f(std::array<int,3>& a);
温馨提示:答案为网友推荐,仅供参考