Hard
Two emplace_backs and one reallocation
What does this program print?
main.cpp
#include <iostream>
#include <vector>
struct Widget {
Widget() = default;
Widget(const Widget&) { std::cout << "copy "; }
Widget(Widget&&) noexcept(false) { std::cout << "move "; } // move ctor exists but is NOT noexcept
};
int main() {
std::vector<Widget> v;
v.reserve(1);
v.emplace_back();
v.emplace_back(); // triggers reallocation
std::cout << std::endl;
}48 of 117 in C++