C++ Logo


Advanced search

Re: std::make_shared and type deduction

From: Kyle Knoepfel <kyleknoepfel_at_[hidden]>
Date: Fri, 10 Jul 2020 08:31:43 -0500
> > > Anyway, what you want isn't a make_unique deduction, but a make_copy.
> >
> > Hmm, not really. I still need the unique_ptr, which is what
> > std::make_unique constructs...and connotes. And if Foo<int> were
> > std::vector<int>, then it wouldn't be a copy either, it would be a move.
> > But maybe you weren't distinguishing between copying/moving in this case.
> I wasn't. I was pointing out that you're creating a new object. So maybe what
> you want is clone_unique() and clone_shared() with perfect forwarding.

Yes, well done--clone_unique() and clone_shared() are good names. Question is would such facilities have enough interest to justify a proposal? I'm kind of doubtful....


Received on 2020-07-10 08:34:59