Stephan Lavavej has submitted a proposal to the C++ Standards committee for make_unique (the std::unique_ptr equivalent to std::make_shared for std::shared_ptr).
make_unique’s presence in the Standard Library will have several wonderful consequences. It will be possible to teach users “never saynew/delete /new[]/delete[]” without disclaimers. Additionally,make_uniqueshares two advantages withmake_shared(excluding the third advantage, increased efficiency). First,unique_ptr<LongTypeName> up(new LongTypeName(args))must mentionLongTypeNametwice, whileauto up = make_unique<LongTypeName>(args)mentions it once. Second,make_uniqueprevents the unspecified-evaluation-order leak triggered by expressions likefoo(unique_ptr<X>(new X), unique_ptr<Y>(new Y)). (Following the advice “never saynew” is simpler than “never saynew, unless you immediately give it to a namedunique_ptr”.)
It’s a really useful utility as demonstrated in this video.