C+中的隐式数组大小+;11类似于C数组 在C++中你可以这样说: int xs[] = { 1, 2 };
在这里,可以在编译时将数组的大小推断为2,因此无需明确说明:C+中的隐式数组大小+;11类似于C数组 在C++中你可以这样说: int xs[] = { 1, 2 };,c++,arrays,c++11,C++,Arrays,C++11,在这里,可以在编译时将数组的大小推断为2,因此无需明确说明: int xs[2] = { 1, 2 }; 是否有与使用C++11数组的第一个构造等效的方法—一种不显式指定大小的定义方法?也许是这样的: array<int, _> xs = { 1, 2 }; // does not compile array xs={1,2};//不编译 而不必指定: array<int, 2> xs = { 1, 2 }; array xs={1,2};
int xs[2] = { 1, 2 };
是否有与使用C++11数组的第一个构造等效的方法—一种不显式指定大小的定义方法?也许是这样的:
array<int, _> xs = { 1, 2 }; // does not compile
array xs={1,2};//不编译
而不必指定:
array<int, 2> xs = { 1, 2 };
array xs={1,2};