Stdle #22 · raii · 2026-06-28
What does this C++ snippet output?
A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
#include <iostream> struct M { M() { std::cout << "ctor\n"; } M(const M&) { std::cout << "copy\n"; } ~M() { std::cout << "dtor\n"; }};M make() { M m; return m; }int main() { M x = make(); std::cout << "got\n";}RAII