Create an associative array with function pointers as the value
vit
vit at vit.vit
Wed Apr 20 11:10:18 UTC 2022
On Wednesday, 20 April 2022 at 10:42:59 UTC, rempas wrote:
> I'm trying to create an associative array where the keys will
> be a "string" type and the values will be function pointers.
> I'm using a custom type is called "file_struct" and for anyone
> that wants to try specifically with this type, the definition
> is the following:
>
> [...]
You need shared static this for initializing immutable AA:
```d
immutable void function(ref file_struct)[string]
common_identifiers;
shared static this(){
common_identifiers = [
"let" : &parse_let,
// "macro" : &parse_macro,
];
}
```
More information about the Digitalmars-d-learn
mailing list