C++ Language/Indirection/SmartPointers/SmartCompilerTemporary

C++ creates a compiler-temporary for the  portion of. To guard against memory leaks from exceptions occuring before that compiler-temporary is given to the smart pointer, use  in place of   (a   compiler-temporary is already a smart pointer as soon as it exists).

Additional information about smart compiler-temporaries (includes interactive examples)