D-Programming-Language/phobos — pull request #1000 by 9rnsr (2012-12-10 05:20:01+00:00)
Title: Improve `std.range.put` for strings.

Sometimes we define a sink function which receives `const(char)[]`, and expect that would work as an output range for *all string/character* values, but this is not true so `std.range.put` has no special treatments for string types.
I think it is inconsistent against the special treatment in `std.array.front`/`popFront` for narrow strings.

Changes:
* Support repetition of `r(e.front)`
When E is an input range, `foreach (; !e.empty; e.popFront()) r.put(e.front);` is supported in current. So we should also support that for the functor output range.
* Support direct put of each narrow character
When E is narrow string type, member put and functor should be able to receive each narrow characters `e[i]` directly.
* Support dchar put with encoding to narrow string
When E is dchar type, std.range.put should be able to encode it to one or more narrow characters, and pass to the given output range.

----
After these improvements, `std.format` will be improved at the same time against functor output ranges. And then, a workaround which added in #997 can be removed.