http://d.puremagic.com/issues/show_bug.cgi?id=6098
bearophile_h...@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_h...@eml.cc --- Comment #7 from bearophile_h...@eml.cc 2011-06-03 10:21:52 PDT --- (In reply to comment #4) > Actually I can just dup manually instead of using the heap: > > return cycle(result.dup); .dup creates a copy on the heap. This is a safer implementation: import std.stdio, std.math, std.algorithm, std.range; auto makeSine() { return cycle(map!q{ sin(a * PI) }(iota(0, 2, 0.2))); } void main() { auto sineTable = makeSine(); writeln(take(sineTable, 10)); } Regarding the unsafety of the version that uses a fixed sized array, I'd like the compiler to warn better against such bugs. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------