Date: Tue, 10 Dec 2024 14:43:52 +0000
Bjorn, if you can figure out how to do that before we have universal
template parameters, be my guest :)
On Tue, Dec 10, 2024 at 2:37 PM Bjorn Reese via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> 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);
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
template parameters, be my guest :)
On Tue, Dec 10, 2024 at 2:37 PM Bjorn Reese via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> 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);
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Received on 2024-12-10 14:44:08