0

Where make_unique is better than unique_ptr(raw pointer)

Hi If both (unique_ptr and make_unique) have same output like i have in this code, what's the advantage of make_unique. https://sololearn.com/compiler-playground/cnxp9hb8AB1E/?ref=app

30th Jul 2025, 6:29 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
3 Answers
+ 2
make_unique is a fundamental improvement for modern C++ development and it provides: Crucial exception safety guarantees. More concise and readable code. Reduced redundancy. Potential minor performance benefits.
30th Jul 2025, 9:02 PM
BroFar
BroFar - avatar
+ 1
reading a reddit topic similar to this question gave me this link as to why make_unique was added later than make_shared: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3588.htm
30th Jul 2025, 11:38 PM
Bob_Li
Bob_Li - avatar
31st Jul 2025, 12:01 AM
BroFar
BroFar - avatar