Applying Placement New to druntime and phobos

Paul Backus snarwin at gmail.com
Wed Mar 5 01:53:02 UTC 2025


On Tuesday, 4 March 2025 at 11:24:43 UTC, Per Nordlöw wrote:
> On Tuesday, 4 March 2025 at 01:27:29 UTC, Manu wrote:
>> Please do contribute to this effort if you're enthusiastic! I 
>> have very
>> little free time rn.
>
> Tried converting a couple of usages of `emplace` and 
> `moveEmplace` in a repo of mine and discovered that I'm missing 
> a way to express
>
> `moveEmplace(x, y)`
>
> as
>
> `new(y) typeof(y)(__rvalue(x))`
>
> . This doesn't always work eventough `y` being assignable from 
> `x`.

For the sake of simplicity, it would be better to start with the 
overloads of `emplace` that create a brand-new object, without 
moving an existing one. That way, you will not have to deal with 
the added complication of `__rvalue` (which itself is still a 
work-in-progress).


More information about the Digitalmars-d mailing list