Bug 13018 – std.string.translate needs mutable translation table

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-07-02T11:26:00Z
Last change time
2014-08-20T11:05:30Z
Assigned to
nobody
Creator
japplegame

Comments

Comment #0 by japplegame — 2014-07-02T11:26:55Z
This code doesn't compile: import std.string; immutable dchar[dchar] tt; shared static this() { tt = ['a': '0', 'b': '1']; } void main() { assert(translate("abc", tt) == "01c"); } http://dpaste.dzfl.pl/1d4a44b51bb3
Comment #1 by rburners — 2014-07-07T14:39:43Z
IMO there is no reason why this should not work, I will have a crack at it. Thanks
Comment #2 by rburners — 2014-07-08T13:17:57Z
Comment #3 by github-bugzilla — 2014-07-21T16:37:22Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/44d97ed1cb228259a4fea3451365c3f1bd87bfb4 issue 13018: translate does not except immutable or const AAs removed the comment some fixes less code https://github.com/D-Programming-Language/phobos/commit/1d6598fe3936ce08c16e9a9c0dc1a6bc49f4cda0 Merge pull request #2312 from burner/issue13018 issue 13018: translate does not accept immutable or const AAs
Comment #4 by rburners — 2014-08-20T11:05:30Z
#2312 got merged