On Tuesday, 16 August 2016 at 18:25:42 UTC, Meta wrote:
What about this?

struct Rnd
{
    int* state;
}

void test()
{
    scope rnd = new Rnd();
    Rnd rnd2 = *rnd;

    saveGlobalState(rnd2);
}

Same as far as I understand, because "from a lifetime analysis viewpoint, a struct is considered a juxtaposition of its direct members" (https://github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md#aggregates). You need to add one more level of indirection for things to start going complicated.
              • Re: ... ZombineDev via Digitalmars-d-announce
              • Re: ... Rory McGuire via Digitalmars-d-announce
              • Re: ... Dicebot via Digitalmars-d-announce
              • Re: ... Rory McGuire via Digitalmars-d-announce
              • Re: ... Dicebot via Digitalmars-d-announce
              • Re: ... Rory McGuire via Digitalmars-d-announce
              • Re: ... Walter Bright via Digitalmars-d-announce
              • Re: ... Patrick Schluter via Digitalmars-d-announce
              • Re: ... Dicebot via Digitalmars-d-announce
              • Re: ... Meta via Digitalmars-d-announce
              • Re: ... Dicebot via Digitalmars-d-announce
              • Re: ... Dicebot via Digitalmars-d-announce
              • Re: ... Rory McGuire via Digitalmars-d-announce
              • Re: ... Chris Wright via Digitalmars-d-announce
              • Re: ... H. S. Teoh via Digitalmars-d-announce
              • Re: ... Walter Bright via Digitalmars-d-announce
              • Re: ... Dicebot via Digitalmars-d-announce
              • Re: ... Chris Wright via Digitalmars-d-announce
              • Re: ... Walter Bright via Digitalmars-d-announce
  • Re: DIP1000: Scoped Pointers H. S. Teoh via Digitalmars-d-announce
  • Re: DIP1000: Scoped Pointers poliklosio via Digitalmars-d-announce

Reply via email to