如何初始化一个 const int 二维 vector :
Const int vector < vector < int > > v ?
v = {1 , 1 ; 1, 0} ?
它不起作用。
最佳答案
你可以这样做(only in C++11):
const vector<vector<int>> v{{1,2,3},{4,5,6}};
另请注意,您无需编写 >>
。由于此问题已在 C++11 中修复,因此 >>>
将起作用。它不会被解释为右移运算符(C++03 就是这种情况)。
关于c++ - 如何在 C++ 中初始化 const int 二维 vector ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8499571/