这是一个重复问题:
make_unique 和完美转发
为什么C++11有
这使得代码非常不一致。
make_unique 和完美转发
为什么C++11有
make_shared
模板,但没有make_unique
模板?这使得代码非常不一致。
auto x = make_shared<string>("abc");
auto y = unique_ptr<string>(new string("abc"));
unique
需要构造一个对象,他们认为显式地完成这个过程更好。 - Bartek Banachewicz