相关疑难解决方法(0)

C++ std :: vector of array的编译器错误

以下代码不能用gcc 4.7.0编译(使用std = c ++ 11 -O3)

int n;
std::vector< int[4] > A;
A.resize(n);
Run Code Online (Sandbox Code Playgroud)

错误消息是长度,但最终

functional cast to array type ‘_ValueType {aka int[4]}‘
Run Code Online (Sandbox Code Playgroud)

它是否正确?还是应该编译?更重要的是,如何避免这个问题?(没有定义一个新的结构来保存int[4])

编辑:

如何用C++ 98解决问题?

c++ arrays stdvector

5
推荐指数
1
解决办法
2171
查看次数

标签 统计

arrays ×1

c++ ×1

stdvector ×1