Why can I not call reserve on a vector of const elements?
This question already has an answer here:
You are violating the requirements for the elements stated by the class vector
. An element must be CopyAssignable.
const int
不是可赋值的,因此它不是一个可以放入任何标准容器的有效类型。
上一篇: 为什么const成员造成错误?