is(ElementType!(char[2]) == dchar - why?

bauss jj_1337 at live.dk
Tue Dec 11 21:02:41 UTC 2018


On Tuesday, 11 December 2018 at 18:10:48 UTC, H. S. Teoh wrote:
> On Wed, Dec 12, 2018 at 06:56:46AM +1300, rikki cattermole via 
> Digitalmars-d-learn wrote:
>> On 12/12/2018 6:51 AM, 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
>> 
>> Because docs: 
>> https://dlang.org/phobos/std_range_primitives.html#ElementType
>> 
>> What you probably want is: 
>> https://dlang.org/phobos/std_traits.html#ForeachType
>
> Autodecoding raises its ugly head again. :-/
>
>
> T

Has it ever had anything else?


More information about the Digitalmars-d-learn mailing list