On 10/31/2013 08:29 PM, Daniel Davidson wrote:
The following crashes on writeln, but looks reasonable. Is some form of
initializing ctor required for RateCurve?
import std.datetime;
import std.range;
import std.stdio;
struct DateRate {
Date date;
double value = 0.0;
}
struct RateCurve {
private immutable(DateRate)[] _data;
}
struct CFS {
double initialValue;
RateCurve growth;
}
void main() {
auto s = CFS(1.0);
// auto s = CFS(1.0, RateCurve()); // crashes
// auto s = CFS(1.0, RateCurve([])); // works
writeln(s);
}
Thanks
Dan
You are not going to like my answer but this may be the 16-byte struct
bug. Add something to RateCurve and your code works fine... :-/
struct RateCurve {
private immutable(DateRate)[] _data;
ubyte b; // <-- ADDED
}
Ali