SList of chars not possible?

Tobias Pankrath tobias at pankrath.net
Fri Nov 2 01:44:42 PDT 2012


The error is: the constructor of SList!T takes a U[] if U is 
implicitly convertible to T, but forwards to insertFront which 
requires a range of T. But inside phobos char[] is a range of 
dchar, so if fails. Imo a clear bug.

> Not sure of the exact reasons, but I think Ali is probably 
> right.
>
> A char cannot hold all possible values for a unicode character, 
> so
> having a range with that element type is not really a good idea.


Still, if you want to have a container of char for whatever 
reasons it shouldn't fail so miserably. The special treatment of 
char[] as range of dchar everywhere in phobos just produces bugs 
and confusion.



More information about the Digitalmars-d-learn mailing list