Why D is annoying =P

Mehrdad wfunction at hotmail.com
Wed Oct 24 15:24:33 PDT 2012


On Wednesday, 24 October 2012 at 21:55:11 UTC, Timon Gehr wrote:
> On 10/24/2012 10:16 PM, Mehrdad wrote:
>> ...
>>
>> Maybe you can fill in the blanks?
>>
>>
>
> import std.stdio;
> struct Set(T){
>     int[T] dict;
>     hash_t toHash() const{
>         typeof(return) r = 0;
>         foreach(item; this.dict.keys){
>             r+=typeid(T).getHash(&item);
>         }
>         return r;
>     }
> }

I'm on my phone so I can't test it right now, but I'm wondering 
how that would possibly work correctly for Tuples and such?


More information about the Digitalmars-d mailing list