Why does the compiler complain about a missing constructor when I'm just resizing my std::vector to a smaller size?
Why does the compiler complain about a missing constructor when I'm just resizing my std::vector to a smaller size?
devblogs.microsoft.com Why does the compiler complain about a missing constructor when I'm just resizing my std::vector to a smaller size? - The Old New Thing
The compiler doesn't know that you're shrinking.
3 comments
Thank you. But why not just init the vector std::vector vect(56) And then resize 🧐
1 0 ReplyThat vector constructor still requires a default constructor for the class of the object contained by the vector, so it's the same issue but different context.
1 0 Reply