C++ Logo


Advanced search

Subject: Re: std::make_shared and type deduction
From: Giuseppe D'Angelo (giuseppe.dangelo_at_[hidden])
Date: 2020-07-07 15:53:03

Il 07/07/20 22:45, Jason McKesson via Std-Discussion ha scritto:
> Perhaps something like:
> auto foo_ptr = std::unique_ptr(external_library::make_foo());
> This works just fine in C++17 through class template argument deduction.

Note that in OP's code make_foo() does not return a pointer, but an
object. Moreover, unique_ptr(pointer) does not participate in CTAD (P0433):

> http://eel.is/c++draft/unique.ptr#single.ctor-6


Giuseppe D'Angelo | giuseppe.dangelo_at_[hidden] | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

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

Older Archives on Google Groups