[vector.capacity] p14 says
constexpr void resize(size_type sz);
Preconditions: T is Cpp17MoveInsertable and Cpp17DefaultInsertable into *this.
Cpp17MoveInsertable is defined in [containers.container.alloc.reqmts] p2.3
T is Cpp17MoveInsertable into X means that the following expression is well-formed:
- allocator_traits::construct(m, p, RV)
[containers.container.alloc.reqmts] p2 says
given an lvalue m of type A, a pointer p of type T*, an expression v of type (possibly const) T, and an rvalue rv of type T,
Consider this example:
struct A{
A() = default;
A(A const&) = default;
A(A&&) = delete;
};
int main(){
std::vector<A> vec{};
vec.resize(10); // ok
}
However, A is not Cpp17MoveInsertable since allocator_traits<A>::construct(m, p, RV) is ill-formed for A.