#What is the approach to store function pointers of different types in a HashMap?

1 messages · Page 1 of 1 (latest)

wanton marten
#

I have a StringHashMap to store various functions by name. The functions have different parameter count and different parameter types. StringHashMap needs a uniform value type.

tranquil folio
neat fog
#

or use a union

#

or a tagged union for more safety

tranquil folio
#

in debug/releasesafe, untagged unions are tagged right?

neat fog
#

yeah

wanton marten
#

Great suggestions. Thanks!

neon blade
tranquil folio
neat fog
#

does not require an addrSpaceCast, even on wasm