Access template parameters at runtime

Denis Shelomovskij verylonglogin.reg at gmail.com
Fri Aug 10 11:12:35 PDT 2012


10.08.2012 19:26, David Nadlinger пишет:
> Just use the compiler tuple inside an array literal, like this:
> [integers]. It will auto-expand, just when passing it to a method.

And if it's impossible/undesirable to create an array, you can do this:
---
foreach(i, t; your_tuple)
     if(i == idx)
         return t; // or do something else
assert(0);
---

-- 
Денис В. Шеломовский
Denis V. Shelomovskij


More information about the Digitalmars-d mailing list