Le 23/03/2018 à 23:43, Xavier Bigand a écrit :
I am trying to initialize an global immutable associative array of structs, but 
it doesn't compile.
I am getting the following error message : "Error: not an associative array 
initializer".

As I really need to store my data for a compile time purpose if we can't do 
that with AA, I'll use arrays instead.

Here is my code :
struct EntryPoint
{
    string  moduleName;
    string  functionName;
    bool    beforeForwarding = false;
}

immutable EntryPoint[string]  entryPoints = [
    "wglDescribePixelFormat": {moduleName:"opengl32.forward_initialization", 
functionName:"wglDescribePixelFormat"}
];

I finally found something that works great:
enum  entryPoints = [
    "wglChoosePixelFormat": EntryPoint("opengl32.forward_initialization", 
"client_wglChoosePixelFormat"),
    "wglDescribePixelFormat": EntryPoint("opengl32.forward_initialization", 
"client_wglDescribePixelFormat")
];

I am able to use this enum like an AA.

Reply via email to