Re: Create an associative array with function pointers as the value

2022-04-20 Thread rempas via Digitalmars-d-learn
On Wednesday, 20 April 2022 at 14:29:33 UTC, rikki cattermole wrote: On 21/04/2022 2:15 AM, rempas wrote: Unfortunately, this will not work for me as it uses "TypeInfo" and it is not available with "-betterC". Thank you for trying to help regardless! You can't use AA's in -betterC. The impl

Re: Create an associative array with function pointers as the value

2022-04-20 Thread rikki cattermole via Digitalmars-d-learn
On 21/04/2022 2:15 AM, rempas wrote: Unfortunately, this will not work for me as it uses "TypeInfo" and it is not available with "-betterC". Thank you for trying to help regardless! You can't use AA's in -betterC. The implementation is not templated and is in druntime.

Re: Create an associative array with function pointers as the value

2022-04-20 Thread rempas via Digitalmars-d-learn
On Wednesday, 20 April 2022 at 11:10:18 UTC, vit wrote: 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" :

Re: Create an associative array with function pointers as the value

2022-04-20 Thread vit via Digitalmars-d-learn
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

Create an associative array with function pointers as the value

2022-04-20 Thread rempas via Digitalmars-d-learn
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: ```d struct file_struct {