Appearance
没问题,new 得到的对象可以 std::unique_ptr 帮忙 delete。
std::unique_ptr
用 std::make_unique 的话,new 也可以不用(除了 placement new)。
std::make_unique
特殊情况,不想让 std::make_unique 给对象初始化(避免初始化开销),就要用 std::make_unique_for_overwrite (C++20) 。
std::make_unique_for_overwrite
智能指针是 RAII 的示范用法。