is(ElementType!(char[2]) == dchar - why?
Paul Backus
snarwin at gmail.com
Tue Dec 11 18:35:23 UTC 2018
On Tuesday, 11 December 2018 at 17:51:56 UTC, Denis Feklushkin
wrote:
> import std.stdio;
> import std.range.primitives;
>
> void main()
> {
> writeln(
> typeid(ElementType!(char[2]))
> );
>
> static assert(is(ElementType!(char[2]) == dchar)); // why?
> }
>
> ?
>
> https://run.dlang.io/is/Q74yHm
This is a "feature" called auto decoding. It's explained here:
https://tour.dlang.org/tour/en/gems/unicode
You can get around it by using .byChar or .byCodeUnit.
More information about the Digitalmars-d-learn
mailing list