Date: Sun, 01 Dec 2024 20:44:59 +0200
On Sun, 2024-12-01 at 18:47 +0100, Bjorn Reese via Std-Proposals 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)...);
> > }
>
> What are the constraints?
>
std::constructible_from<T, Args...>
> Should it work for aggregate types?
>
Yes
> Should it work for copy/move constructors?
>
Yes!
> Should it work with cv-qualification?
>
I don't know what's the consensus on that.
> 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)...);
> > }
>
> What are the constraints?
>
std::constructible_from<T, Args...>
> Should it work for aggregate types?
>
Yes
> Should it work for copy/move constructors?
>
Yes!
> Should it work with cv-qualification?
>
I don't know what's the consensus on that.
Received on 2024-12-01 18:45:04