Date: Tue, 10 Dec 2024 15:36:50 +0100
On 12/1/24 16:57, Avi Kivity via Std-Proposals wrote:
> Functions and member functions are invocable, but constructors are not.
>
> I propose to add
>
> template <typename T, typename... Args>
> T std::construct(Args&&... args) {
> return T(std::forward<decltype(Args)>(args)...);
> }
Should this support automatic argument type deduction?
For instance, with the proposed function we would have to specify all
template types explicitly:
auto t = construct<tuple<int, float>>(1, 2.f);
rather than
auto t = construct<tuple>(1, 2.f);
> Functions and member functions are invocable, but constructors are not.
>
> I propose to add
>
> template <typename T, typename... Args>
> T std::construct(Args&&... args) {
> return T(std::forward<decltype(Args)>(args)...);
> }
Should this support automatic argument type deduction?
For instance, with the proposed function we would have to specify all
template types explicitly:
auto t = construct<tuple<int, float>>(1, 2.f);
rather than
auto t = construct<tuple>(1, 2.f);
Received on 2024-12-10 14:36:53