On Sun, 15 Mar 2015 16:34:14 -0700, Charles Hixson via Digitalmars-d-learn
wrote:

if you know the exact layouts of `spare`, you can use union for that:

struct S {
  // ...
  union {
    ulong[61] spare;
    struct { int vala; ubyte valb; }
    // etc.
  }
}

and then you can use it like this:

  auto s = S();
  s.vala = 42;
  assert(s.spare[0] == 42);

you can also write a CTFE function that builds struct to cast where 
`spare` is changed to something else, using `S` as a source, but this 
solution will not be pretty. ;-)

Attachment: signature.asc
Description: PGP signature

Reply via email to