https://d.puremagic.com/issues/show_bug.cgi?id=7175
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #2 from [email protected] 2013-11-27 00:46:46 PST --- Do you mean in this code: import core.stdc.stdlib, std.stdio; struct VariableLength(T) { size_t len; T[0] items; @property T[] data() inout pure nothrow { return (cast(T*)&items)[0 .. len]; } static typeof(this)* New(in size_t len) nothrow { auto vptr = cast(typeof(this)*)calloc(1, typeof(this).sizeof + T.sizeof * len); vptr.len = len; return vptr; } alias data this; } void main() { enum n = 0100; auto v = VariableLength!int.New(n); foreach (immutable i; 0 .. n) (*v)[i] = i * 10; foreach (immutable i; 0 .. n) writeln((*v)[i]); } The data() function will be written just like this? @property T[] data() inout pure nothrow { return items.ptr[0 .. len]; } -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
