Re: Templated delegate as template argument for structs

2021-02-20 Thread Simon van Bernem via Digitalmars-d-learn
Thanks! The alias solution works and is good enough for me. Also thanks for providing the code to typecheck the alias, I would have never been able to come up with that myself.

Re: Templated delegate as template argument for structs

2021-02-20 Thread Simen Kjærås via Digitalmars-d-learn
On Saturday, 20 February 2021 at 09:16:46 UTC, Simon van Bernem wrote: I have the following struct declaration: struct Hash_Table(Key, Value, u32 delegate(ref Key) custom_hash_function = null) [snip] I take it from the error that the problem is not actually the delegate that I am passing,

Templated delegate as template argument for structs

2021-02-20 Thread Simon van Bernem via Digitalmars-d-learn
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