"tuple unpacking" with zip?

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 21 05:32:46 PDT 2015


On Wednesday, 21 October 2015 at 12:07:12 UTC, Shriramana Sharma 
wrote:
> John Colvin wrote:
>
>> static assert(is(ElementType!string == dchar));
>
> But this is false, no? Since ElementType!string is char and not 
> dchar?

No. char[], wchar[] and dchar[] all have ElementType dchar. 
Strings are special for ranges. It's a bad mistake, but it is 
what it is and apparently won't be changed.

>> foreach(int i, dchar c; zip(ints, chars))
>> or
>> foreach(i, c; zip(ints, chars))
>
> What's the diff betn char and dchar in this particular context?

See http://dlang.org/type.html and  
http://dlang.org/arrays.html#strings


More information about the Digitalmars-d mailing list