C++ Logo


Advanced search

Subject: Re: std::make_shared and type deduction
From: Ville Voutilainen (ville.voutilainen_at_[hidden])
Date: 2020-07-10 11:27:36

On Fri, 10 Jul 2020 at 19:26, Hans Ã…berg via Std-Discussion
<std-discussion_at_[hidden]> wrote:
> > On 10 Jul 2020, at 15:31, Kyle Knoepfel via Std-Discussion <std-discussion_at_[hidden]> wrote:
> >
> >> 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....
> One can have polymorphic copy and move operators, by adding to every class A:
> virtual A* new_p() const& { return new A(*this); }
> virtual A* new_p() && { return new A(std::move(*this)); }
> Perhaps the latter would do your job.

There are things like
that don't require that.

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

Older Archives on Google Groups