On Wednesday, 10 September 2025 at 13:13:34 UTC, Richard (Rikki)
Andrew Cattermole wrote:
Placement new is @system, but you wanted to use it in an @safe
function iff the constructor to be called is @safe as well.
Pretty much.
The reason placement new is @system is because of double-init.
It can't be a safe operation.
What?! Like, it assigns to the memory twice? What's the point of
this feature, then? I thought this could essentially replace
`emplace` for constructing types into uninitialised memory, but
instead it's just a booby-trap that stops people from making
their code `@safe`?
- Placement new an... IchorDev via Digitalmars-d-learn
- Re: Placeme... Dennis via Digitalmars-d-learn
- Re: Pla... Paul Backus via Digitalmars-d-learn
- Re:... IchorDev via Digitalmars-d-learn
- Re: Pla... IchorDev via Digitalmars-d-learn
- Re: Placeme... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
- Re: Pla... IchorDev via Digitalmars-d-learn
- Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
- ... IchorDev via Digitalmars-d-learn
- ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
- ... IchorDev via Digitalmars-d-learn
- ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
- ... IchorDev via Digitalmars-d-learn
- ... Paul Backus via Digitalmars-d-learn
- ... IchorDev via Digitalmars-d-learn
- ... Nick Treleaven via Digitalmars-d-learn