Eponymous templates ambiguity

bearophile bearophileHUGS at lycos.com
Sat Aug 3 04:35:43 PDT 2013


andrea9940:

> ( complete code at http://pastebin.com/FhmrgmZZ )

Simpler code:


import std.stdio;
import std.typecons;

private immutable extensionTable = [
         ["WGL_ARB_make_current_read",
         "void function(int, int, int)", 
"wglMakeContextCurrentARB",
         "void function()", "wglGetCurrentReadDCARB"],

         ["WGL_ARB_pixel_format_float"],

         ["WGL_ARB_create_context",
         "void function(int, int, int)", 
"wglCreateContextAttribsARB"],
];

string eval() {
     string code;
     foreach (const array; extensionTable)
         for (uint index = 1; index < array.length; index += 2)
             code ~= "alias nothrow " ~ array[index] ~ " da_" ~ 
array[index + 1] ~ ";";
     return code;
}

mixin(eval);

void main() {
     assert(is(da_wglCreateContextAttribsARB));
}


Bye,
bearophile


More information about the Digitalmars-d-learn mailing list