typeof(string.front) should be char
Ali Çehreli
acehreli at yahoo.com
Fri Mar 2 20:41:35 PST 2012
On 03/02/2012 06:30 PM, Piotr Szturmaj wrote:
> Hello,
>
> For this code:
>
> auto c = "test"c;
> auto w = "test"w;
> auto d = "test"d;
> pragma(msg, typeof(c.front));
> pragma(msg, typeof(w.front));
> pragma(msg, typeof(d.front));
>
> compiler prints:
>
> dchar
> dchar
> immutable(dchar)
>
> IMO it should print this:
>
> immutable(char)
> immutable(wchar)
> immutable(dchar)
>
> Is it a bug?
No, that's by design. When used as InputRange ranges, slices of any
character type are exposed as ranges of dchar.
Ali
More information about the Digitalmars-d-learn
mailing list