I have been reading GOTW102, and wonder, why make_unique is more exception safe than the other cases, or in detail why f(new T(...)) is more exception safe than f(new T1(...), new T2(...)).
The make_unique implementation from the blog reads:
template<typename T, typename ...Args>
std::unique_ptr<T> make_unique( Args&& ...args )
{
return std::unique_ptr<T>( new T( std::forward<Args>(args)... ) );
}
Now I wonder if f(new T(...)) is in general exception safe (leak free), or if it is just exception safe in the case of make_unique because of the added knowledge that the constructor of std::unique_ptr does not throw? (Since if it would the freshly constructed T would be leaked anyways according to my understanding.