Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumC++exception-safety guaranteesSingle-choice MCQ

Why is `push_back` on a `std::vector` able to provide the strong exception guarantee during reallocation only when the element type meets a specific requirement?

std::vector<T> v; // v needs to grow: allocate new buffer, move/copy elements over v.push_back(t);