Bug 16342 – std.algorithm.fill can't fill a char[]?

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-07-31T19:00:29Z
Last change time
2020-03-21T03:56:41Z
Keywords
trivial
Assigned to
No Owner
Creator
cy

Comments

Comment #0 by dlang — 2016-07-31T19:00:29Z
void main() { char[] thing; import std.algorithm.mutation: fill; fill(thing,cast(char)'Q'); } // Error: template std.algorithm.mutation.fill cannot deduce function from argument types !()(char[], char)
Comment #1 by b2.temp — 2016-07-31T20:28:27Z
front(char[]) is not assignable, it's not a reference. If you look at the contraint, "range.front = value" must be compilable. front(char[]) is not assignable because it decodes an undetermined amount of bytes. That said there's no valid reason to disallow to fill with a char since it can fill exactly array.length times the array.
Comment #2 by niklas.volcz — 2016-09-22T12:32:29Z
Was bitten by this issue today. Can we at least improve the error message?
Comment #3 by greeenify — 2016-12-30T08:04:24Z
Comment #4 by github-bugzilla — 2017-03-13T18:21:17Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/bab801c6723a945282b9b778c671791e6676937c fix issue 16342 - add std.algorithm.mutation.fill fallback for mutable strings https://github.com/dlang/phobos/commit/c6aa7b8ada515c487687e42ebf6d2d733e0cab93 Merge pull request #5128 from BBasile/issue-16342 fix issue 16342 - add std.algorithm.mutation.fill fallback for mutable strings merged-on-behalf-of: Jack Stouffer <[email protected]>
Comment #5 by github-bugzilla — 2017-03-22T12:22:24Z
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/bab801c6723a945282b9b778c671791e6676937c fix issue 16342 - add std.algorithm.mutation.fill fallback for mutable strings https://github.com/dlang/phobos/commit/c6aa7b8ada515c487687e42ebf6d2d733e0cab93 Merge pull request #5128 from BBasile/issue-16342
Comment #6 by github-bugzilla — 2017-08-07T12:26:13Z
Commits pushed to newCTFE at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/bab801c6723a945282b9b778c671791e6676937c fix issue 16342 - add std.algorithm.mutation.fill fallback for mutable strings https://github.com/dlang/phobos/commit/c6aa7b8ada515c487687e42ebf6d2d733e0cab93 Merge pull request #5128 from BBasile/issue-16342
Comment #7 by github-bugzilla — 2018-01-05T13:27:47Z
Commit pushed to dmd-cxx at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/c6aa7b8ada515c487687e42ebf6d2d733e0cab93 Merge pull request #5128 from BBasile/issue-16342