[Issue 11415] Assign range to array
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Nov 2 02:09:13 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11415
yazan.dabain at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |yazan.dabain at gmail.com
--- Comment #2 from yazan.dabain at gmail.com 2013-11-02 02:09:07 PDT ---
Filter produces a lazy range. In other words, it is not an int array. To store
the result of filter in d[] you need to eagerly evaluate it. To do that you can
use std.array.array on the result of filter.
The code becomes:
int[] d = [1,2,3,4,5,6,7];
d = d.filter!(x => x > 3).array();
If this answers your question, please close the bug.
http://dlang.org/phobos/std_array.html#.array
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list