"The C++ Standard forbids containers of const elements "
"because allocator<const T> is ill-formed."
这个ill-formed是什么意思?
高洛峰2017-04-17 13:14:23
I don’t know what container you are using, if it is a vector, because when the vector adds elements, if there is not enough space, it will reallocate more memory, and copy the original vector elements and reassign them to the new vector. If the element type is const, reassignment is not supported. So the compiler will report an error
怪我咯2017-04-17 13:14:23
Ill means pathological, bad and undesirable. Ill formed is the wrong form.
How do you modify const T when it is new... The standard library container does not support const T because it cannot be modified. , you need to copy your elements like vector.