www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13018] New: std.string.translate needs mutable translation

https://issues.dlang.org/show_bug.cgi?id=13018

          Issue ID: 13018
           Summary: std.string.translate needs mutable translation table
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: japplegame gmail.com

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

--
Jul 02 2014