On Thursday, 16 February 2017 at 00:49:45 UTC, Adam D. Ruppe wrote:
On Thursday, 16 February 2017 at 00:43:30 UTC, David Zhang wrote:
struct S {
    O object;
}

import std.typecons;

Rebindable!O object;

http://dpldocs.info/experimental-docs/std.typecons.Rebindable.html

Is there a similar mechanism for one struct holding another? Otherwise, you get a cannot modify X with immutable members error.

eg:

struct A {
    B b;
}

struct B {
    const size_t something;
}

A a = A(B(16));

//attempt to replace a.b with new B
a.b = B(32); //error: cannot modify struct a.b B with immutable members

Reply via email to