|
|
|
|
|
by elb2020
1652 days ago
|
|
"The problem? Convenience. Who wants to type std::unique_ptr<Foo> when instead you can write Foo *?" I think this is an imagined problem. If you use Foo * for ownership, you will need to write new Foo() + delete foo. I don't really think that's more convenient than just writing std::make_unique<Foo>(). It's more a matter of old habit, I think. Still, if C++ was designed as a new language today, I think there's a chance that unique pointers would have made their way into the native language specification, together with for instance std::tuple, instead of being library features, like they are today. |
|