Associative Arrays with elements having function type?
H. S. Teoh
hsteoh at qfbox.info
Mon Nov 3 22:29:13 UTC 2025
On Mon, Nov 03, 2025 at 09:29:47PM +0000, kdevel via Digitalmars-d wrote:
> Yesterday I read
>
> 3. Neither the KeyTypes nor the element types of an associative array
> can be function types or void.
>
> in <https://dlang.org/spec/hash-map.html>. Does the program below work
> only accidentally?
[...]
I think this is a mistake in the spec. There is no reason why the value
type of an AA can't be a function (pointer) or delegate. I use this
quite a lot.
However, there may be a restriction that the key type cannot be a
function.
T
--
Tell me and I forget. Teach me and I remember. Involve me and I understand. -- Benjamin Franklin
More information about the Digitalmars-d
mailing list