Can C 11 Use vector
In C 03, containers had blanket requirements for operations like copy constructibility and assignability. However, C 11 introduced fine-grained requirements for each operation, allowing certain operations on types that are copy-constructible but not assignable.
While this may suggest the possibility of storing const T in a vector, the standard's allocator requirements prohibit this. They specify that T must be a "non-const, non-reference object type."
Storing a vector of constant objects would be impractical, and a const vector
Additionally, implementing vector
The above is the detailed content of Can C 11 Vectors Store `const T` Objects?. For more information, please follow other related articles on the PHP Chinese website!