I am still confused about the requirements for a type to be used with a std::vector
in C++11, but this may be caused by a buggy compiler (gcc 4.7.0). This code:
void resize(size_type)
requires CopyInsertable
, which means that an allocator should be able to construct-copy the type:
::new((void*)p)A(A());
This means that a copy-constructor is required. You should be able to bypass this with a custom allocator:
struct Allocator: public std::allocator {
void construct(A *, const A &) { }
};
However libstdc++ does not respect this; see Should (in C++11) std::vector::resize(size_type) work for the default constructible value_type int[4]?