no match for 'operator='(operand type are 'std::vector' and 'float'

代码:

std::vector predictions[10];
	for (int i = 0; i < 10; i++)
	{
		predictions[i] = out[i];
	}

报错:
no match for ‘operator=’(operand type are ‘std::vector’ and ‘float’

原因:
vector predictions[10];
…declares 10 vectors of int with size 0, so when you do:
predictions[i] = out[i];
predictions[i] is the ith vector, so you try to assign out[i] which is a float to predictions[i] which is vector.

If you want a single vector of size 10, the correct syntax is:
vector predictions(10);

你可能感兴趣的:(no match for 'operator='(operand type are 'std::vector' and 'float')