C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::construct<T>

From: Avi Kivity <avi_at_[hidden]>
Date: Tue, 03 Dec 2024 16:09:29 +0200
It is not a contradiction.

"Everywhere that uses perfect forwarding" = every utility like
std::construct (examples: emplace, std::apply)

"one class is broken" = pin<> refuses to be movable, breaking itself as
an argument type except in the places where the standard mandates
construction-in-place.

btw, if we had a pin_placeholder_t (or something) and a pin constructor
that accepted pin_placeholder_t, we could pass a pin_placeholder_t to
std::construct(). e.g. std::construct<pin<int>>(pin_placeholder_t()).

On Tue, 2024-12-03 at 12:06 +0100, Sebastian Wittmeier via Std-
Proposals wrote:
>
> Hi Avi,
>
> Is this a contradiction?
>
> "The problem happen anywhere you use perfect forwarding."
> "Just because one class is broken wrt perfect forwarding"
>
>
>
> > That's a peculiarity of pin<> and isn't related to construct<>.
> >
> > The problem with pin<> will happen anywhere you use perfect
> > forwarding, for example you can't use it with std::apply(). Just
> > because one class is broken wrt perfect forwarding doesn't mean we
> > can't use perfect forwarding any more.

Received on 2024-12-03 14:09:36