Exception safety and make_unique
Not only when you have multiple allocations, but whenever you can throw at different places. Consider this: f(make_unique<T>(), function_that_can_throw()); Versus: f(unique_ptr<T>(new T), function_that_can_throw()); In the second case, the compiler is allowed to call (in order): new T function_that_can_throw() unique_ptr<T>(…) Obviously if function_that_can_throw actually throws then you leak. make_unique prevents this case. And of course, a … Read more