Can the following be made to build and run, but keep the intent of what is shown. I realize it touches on several bugs related to const, postblit, and map - but I'm having trouble finding the magic combination. The idea is simply have assets store multiple series of data in a map indexed by the asset name.

Thanks,
Dan

import std.stdio;
struct Series {
  // REQUIRED - need to have no aliasing
  this(this) { data = data.dup;  }
  private double[] data;
}

struct Assets {
  this(this) { itemToSeries.dup; }
  // REQUIRED - want ctor to dup arg to ensure no aliasing
  this(const(Series[string]) source) {
    itemToSeries = source.dup;
  }
  private Series[string] itemToSeries;
}

void main() {
  auto data = [ "house" : Series([1,2,3.0])];
  auto assets = Assets(data);
  writeln(assets);
}

Reply via email to