Char representation

Daniel Kozak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Nov 22 05:36:01 PST 2016


Dne 22.11.2016 v 14:29 RazvanN via Digitalmars-d-learn napsal(a):

> Given the following code:
>
>  char[5] a = ['a', 'b', 'c', 'd', 'e'];
>  alias Range = char[];
>  writeln(is(ElementType!Range == char));
>
> One would expect that the program will print true. In fact, it prints 
> false and I noticed that if Range is char[], wchar[], dchar[], string, 
> wstring, dstring
> Unqual!(ElementType!Range) is dchar. I find it odd that the internal 
> representation for char and string is dchar. Is this a bug?
RTFM: https://dlang.org/library/std/range/primitives/element_type.html


More information about the Digitalmars-d-learn mailing list