I thought the 'placement new' feature might replace my need for `emplace`, but I don't see a way to mark a placement new as `@trusted` without marking the call to the object's constructor as `@trusted` also?

```d
void main() @safe{
        X x;
        //placement new is @system, so we have to wrap it in @trusted:
        X* xPtr = (() @trusted => new (x) X(500))();
}

struct X{
        void* a;
        this(int a) @system{
                //but we don't want to mark THIS as @trusted!
                this.a = cast(void*)a;
        }
}
```

If anyone has any ideas, please let me know.
  • 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

Reply via email to