I have the following struct declaration:

struct Hash_Table(Key, Value, u32 delegate(ref Key) custom_hash_function = null){

...

}


When I try to instance the Type like this:


Hash_Table!(Component*, Component_Tick_Info, (c) => hash32(c.handle.bitfield)) my_hash_table;


I get the following compile error


source\vbl.d(2338): Error: undefined identifier `Key`
source\vessel.d(840): while looking for match for `__lambda4!Key` source\vessel.d(840): while looking for match for `Hash_Table!(Component*, Component_Tick_Info, (c) => hash32(c.handle.bitfield))`


vbl.d(2338) is the line of the struct declaration.

I take it from the error that the problem is not actually the delegate that I am passing, but the fact that the delegate type has another template parameter as the argument type. Can template arguments in D not reference previous template arguments? Is there some way I can get around this?

Reply via email to