C++ Logo


Advanced search

Subject: Re: Making the new expression smart
From: Christopher Head (chead_at_[hidden])
Date: 2020-09-17 14:22:55

On Thu, 17 Sep 2020 21:13:30 +0200
Richard Hodges via Std-Discussion <std-discussion_at_[hidden]>

> In this case, yes. But then so does initialising a shared_ptr with a
> naked pointer, so nothing would be lost.

I think it’s a perspective thing. Today people generally try to avoid
using new because it returns raw pointers, so make_unique and
make_shared are common. I figured the point of changing operator new to
return smart pointers would be to use new more and get away from the
make_foo functions, at which point the double-allocation problem would

Christopher Head

STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups