D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 16342 - std.algorithm.fill can't fill a char[]?
Summary: std.algorithm.fill can't fill a char[]?
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 minor
Assignee: No Owner
URL:
Keywords: trivial
Depends on:
Blocks:
 
Reported: 2016-07-31 19:00 UTC by cy
Modified: 2020-03-21 03:56 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description cy 2016-07-31 19:00:29 UTC
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 basile-z 2016-07-31 20:28:27 UTC
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 niklas.volcz 2016-09-22 12:32:29 UTC
Was bitten by this issue today. Can we at least improve the error message?
Comment 4 github-bugzilla 2017-03-13 18:21:17 UTC
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 <jack@jackstouffer.com>
Comment 5 github-bugzilla 2017-03-22 12:22:24 UTC
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 github-bugzilla 2017-08-07 12:26:13 UTC
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 github-bugzilla 2018-01-05 13:27:47 UTC
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