Why can I not call reserve on a vector of const elements?

This question already has an answer here:

  • Why does stack<const string> not compile in g++? [duplicate] 2 answers

  • You are violating the requirements for the elements stated by the class vector . An element must be CopyAssignable.


    const int不是可赋值的,因此它不是一个可以放入任何标准容器的有效类型。

    链接地址: http://www.djcxy.com/p/66740.html

    上一篇: 为什么const成员造成错误?

    下一篇: 为什么我不能在const元素的向量上调用reserve?