April 03, 2013 [Issue 9867] New: Map opIndex is not usable with immutable types | ||||
---|---|---|---|---|
| ||||
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@puremagic.com ReportedBy: andrej.mitrovich@gmail.com --- Comment #0 from Andrej Mitrovic <andrej.mitrovich@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: ------- |
April 03, 2013 [Issue 9867] Map opIndex is not usable with immutable types | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=9867 --- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-04-03 11:51:08 PDT --- It seems like most methods in MapResult should be inout (or const? I never know..), except maybe popFront. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation