make_unique with brace initialization
问题 https://en.cppreference.com/w/cpp/memory/unique_ptr/make_unique writes that std::make_unique can be implemented as template<typename T, typename... Args> std::unique_ptr<T> make_unique(Args&&... args) { return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); } This does not work for plain structs with no constructors. Those can be brace-initialized but don't have a non-default constructor. Example: #include <memory> struct point { int x, z; }; int main() { std::make_unique<point>(1, 2)