C++ Logo


Advanced search

Re: std::make_shared and type deduction

From: Thiago Macieira <thiago_at_[hidden]>
Date: Wed, 08 Jul 2020 15:04:58 -0700
On Wednesday, 8 July 2020 14:15:43 PDT Kyle Knoepfel via Std-Discussion wrote:
> > 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.

Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel System Software Products

Received on 2020-07-08 17:08:16