C++ Logo

STD-DISCUSSION

Advanced search

Subject: Re: std::make_shared and type deduction
From: Kyle Knoepfel (kyleknoepfel_at_[hidden])
Date: 2020-07-10 08:31:43


> > > 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....

Kyle


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

Older Archives on Google Groups