https://d.puremagic.com/issues/show_bug.cgi?id=12470
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #3 from [email protected] 2014-03-27 04:43:21 PDT --- (In reply to comment #2) > (In reply to comment #1) > > Still, that code cannot be compiled, right? > > > > inout is a wildcard that should be able to take place of const and immutable > > but std.array.replace cannot work with const(char)[] nor with > > immutable(char)[]. > > I thought it was supposed to allocate a new array to store the result to? Seems that way: http://dlang.org/phobos/std_array.html#replace Replace occurrences of from with to in subject. Returns a new array without changing the contents of subject, or the original array if no match is found. /---- import std.array, std.stdio; void main() { int[] c = [1, 2, 3]; c.replace([2], [4, 4]).writeln(); //[1, 4, 4, 3]; c.writeln(); //[1, 2, 3]; c.idup.replace([2], [4, 4]).writeln(); //[1, 4, 4, 3]; } //---- Ali must be thinking about "replaceInPlace" ? -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
