只是为了澄清一下,make_unique当你在表达式中有多个分配而不只是一个时,使用只会增加异常安全性,对吗?例如
make_unique
void f(T*); f(new T);
是完全异常安全(就分配和东西而言),而
void f(T*, T*); f(new T, new T);
是不正确的?
c++ unique-ptr exception-safety c++11
c++ ×1
c++11 ×1
exception-safety ×1
unique-ptr ×1