[Issue 5630] New: array() of iterable of immutable items
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Feb 20 15:04:31 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5630
Summary: array() of iterable of immutable items
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2011-02-20 15:01:52 PST ---
A D2 program:
import std.algorithm: map;
import std.array: array;
void main() {
auto r = map!q{ "A"[0] }([0, 1, 2]);
auto a = array(r); // Error: result[i] isn't mutable
assert(a == "AAA");
}
DMD 2.052 gives the errors:
...\dmd\src\phobos\std\array.d(62): Error: result[i] isn't mutable
test.d(5): Error: template instance std.array.array!(Map!(result,int[])) error
instantiating
In my opinion array() needs to be able to build an array of immutable items
too, like a string from its immutable chars.
--
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