-1
阵列获取迭代器我读了另一个计算器后(variable length array error when passing array using template deduction),下面应该是可能的:与C++中的固定长度
#include <iostream>
int input() {
int a;
std::cin>>a;
return a;
}
int main()
{
const int b = input();
int sum[b];
std::begin(sum);
}
除了它似乎并没有工作,我仍然得到类似的错误。
In function 'int main()':
16:17: error: no matching function for call to 'begin(int [b])'
16:17: note: candidates are:
后面跟着可能的模板信息。
'#include'。但是,不要使用C风格的数组 - 所以'#include '代替。 –
LogicStuff
'input()'不是一个常量表达式。 – Rakete1111
'#包括'没有解决它。是否有可能使cin的结果保持不变?我想它是切换到矢量比。 –
Yadeses