[Issue 14998] Cannot put a char into a char[]

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Dec 1 07:53:26 PST 2015


https://issues.dlang.org/show_bug.cgi?id=14998

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |schveiguy at yahoo.com
         Resolution|---                         |WONTFIX

--- Comment #3 from Steven Schveighoffer <schveiguy at yahoo.com> ---
a char[] is not a range of char but rather a range of dchar.

Phobos refuses to put into an auto-decode range (the 'front' result of a char[]
is not ref, so cannot be written to).

The solution is to use byCodeUnit:

import std.utf;
auto r = c.byCodeUnit;
r.put('c');

I think there is general agreement that auto-decode strings were a mistake, but
until that decision is changed, this can't be fixed.

--


More information about the Digitalmars-d-bugs mailing list