C++ Logo


Advanced search

Re: std::make_shared and type deduction

From: Hans Åberg <haberg-1_at_[hidden]>
Date: Fri, 10 Jul 2020 22:02:01 +0200
> On 10 Jul 2020, at 21:57, Kyle Knoepfel <kyleknoepfel_at_[hidden]> wrote:
> If I were in control of the type, then sure, that could work. But Foo<T> (from the original post) could represent any template (or type, for that matter), which I don't necessarily have control over. For example, I can't add new_p member functions to std::vector. The solution would be a free function, and Thiago's suggested such names as clone_unique(..)/clone_shared(..), which accurately describe the need.

The idea would be to have something like that in the standard.

Received on 2020-07-10 15:05:20