Re: Output-Range and char

2017-04-23 Thread Jonathan Marler via Digitalmars-d-learn
On Sunday, 23 April 2017 at 11:17:37 UTC, Mafi wrote: Hi there, every time I want to use output-ranges again they seem to be broken in a different way (e.g. value/reference semantics). This time it is char types and encoding. [...] Use sformat: import std.format, std.stdio; void main() {

Re: Output-Range and char

2017-04-23 Thread Mafi via Digitalmars-d-learn
On Sunday, 23 April 2017 at 12:03:58 UTC, Ali Çehreli wrote: On 04/23/2017 04:17 AM, Mafi wrote: /opt/compilers/dmd2/include/std/range/primitives.d(351): Error: static assert "Cannot put a char into a char[]." Appender recommended: import std.format, std.stdio, std.array; void main() {

Re: Output-Range and char

2017-04-23 Thread Ali Çehreli via Digitalmars-d-learn
On 04/23/2017 04:17 AM, Mafi wrote: /opt/compilers/dmd2/include/std/range/primitives.d(351): Error: static assert "Cannot put a char into a char[]." Appender recommended: import std.format, std.stdio, std.array; void main() { auto sink = appender!(char[])(); formattedWrite(sink,

Output-Range and char

2017-04-23 Thread Mafi via Digitalmars-d-learn
Hi there, every time I want to use output-ranges again they seem to be broken in a different way (e.g. value/reference semantics). This time it is char types and encoding. How do I make formattedWrite work with a char buffer? I tried the following code and it fails with a *static assert*; it