I have declared the following in my code
vector mylist;
I get the following compile error -
new_allocator
The use of the push_back method is the problem. emplace_back will compile.
Another alternative (depending on the whole situation you do not describe here) would be to use a vector if the inserted items have a life outside the vector.
Items in a vector do not need to be assignable, but when they are not, some member functions and algorithms can not be used.
Explanation :
push_back is supposed to first default-construct an A in the vector, then assign (using copy-construct) the given reference. This breaks your const qualification, hence does not compile.
emplace_back uses "perfect forwarding" to invoke the actual constructor directly in place.