[Issue 9867] New: Map opIndex is not usable with immutable types
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Apr 3 11:49:34 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9867
Summary: Map opIndex is not usable with immutable types
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-04-03 11:49:33 PDT ---
import std.algorithm;
private immutable string[12] longMonthNames = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
];
immutable shortMonthNames = map!(a => a[0..3])(longMonthNames[]); // L24
void main()
{
string jan = shortMonthNames[0];
}
test.d(24): Error: mutable method test.MapResult!(__lambda2,
immutable(char[])[]).MapResult.opIndex is not callable using a immutable object
--
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