C++ Logo


Advanced search

Re: std::make_shared and type deduction

From: Kyle Knoepfel <kyleknoepfel_at_[hidden]>
Date: Fri, 10 Jul 2020 14:57:33 -0500
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.

Received on 2020-07-10 15:00:59