Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumC++move semantics and rvalue refsSingle-choice MCQ

A `std::vector<Widget>` has `reserve(N)` already called. Widget has a noexcept move constructor and a copy constructor. What is printed?

Widget w; v.push_back(std::move(w)); // line A Widget w2; v.push_back(w2); // line B