Output-Range and char
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Apr 23 05:03:58 PDT 2017
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, "Long string %s\n", "more more more");
write(sink.data);
}
Of course appender!string is more natural but I just wanted to see that
it works with char[] as well.
Ali
More information about the Digitalmars-d-learn
mailing list