looking for V[string] workarounds
Dan
dbdavidson at yahoo.com
Wed Mar 20 07:34:35 PDT 2013
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);
}
More information about the Digitalmars-d-learn
mailing list