The following works and is the only way I have found to initialize m.
Unfortunately it requires the cast.

Is this safe to do?
Is there a better way?
Is this a bug or are future features coming to clean it up?

Thanks
Dan

----------------------------------
import std.stdio;
struct S {
  this(this) { x = x.dup; }
  char[] x;
}

const(S[string]) m;
static this() {
  // Is there a cleaner way?
  cast(S[string])m = [ "foo" : S(['a']) ];
}

void main() {
  writeln(m["foo"]);
}

Reply via email to