digitalmars.D.bugs - [Issue 12470] New: std.array.replace does not work with inout(char)[]
- d-bugmail puremagic.com (36/36) Mar 25 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12470
- d-bugmail puremagic.com (13/13) Mar 26 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12470
- d-bugmail puremagic.com (7/12) Mar 27 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12470
- d-bugmail puremagic.com (25/33) Mar 27 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12470
- d-bugmail puremagic.com (6/6) Mar 27 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12470
https://d.puremagic.com/issues/show_bug.cgi?id=12470 Summary: std.array.replace does not work with inout(char)[] 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 23:13:19 CET --- ----- import std.array; inout(char)[] sanitize(inout(char)[] input) { return input.replace("\0", " "); } ----- $ dmd test.d ----- C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\array.d(1835): Error: template std.array.replaceInto cannot deduce function from argument types !()(Appender!(inout(char)[]), inout(char)[], string, string), candidates are: C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\array.d(1844): std.array.replaceInto(E, Sink, R1, R2)(Sink sink, E[] subject, R1 from, R2 to) if (isOutputRange!(Sink, E) && isDynamicArray!(E[]) && isForwardRange!R1 && isForwardRange!R2 && (hasLength!R2 || isSomeString!R2)) test.d(7): Error: template instance std.array.replace!(inout(char), string, string) error instantiating ----- Note that this is an internal library error. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 25 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12470 Ali Cehreli <acehreli yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |acehreli yahoo.com 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)[]. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 26 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12470 12:12:05 CET ---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? -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 27 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12470 monarchdodra gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |monarchdodra gmail.comSeems 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: -------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?
Mar 27 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12470 Sorry for the noise. :( Yes, I thought it was in-place. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 27 2014