Iterating a typle tuple of templates
Jacob Carlborg
doob at me.com
Thu Mar 3 23:41:48 PST 2011
On 2011-03-04 04:37, bearophile wrote:
> I am allowed to create a type tuple of function templates, but then it seems I am not allowed to use a static foreach on that type tuple:
>
>
> import std.typetuple;
>
> int foo(T)(T x) {
> return 0;
> }
>
> void main() {
> alias TypeTuple!(foo, foo) t2;
> static assert(t2[0](0) == 0); // OK
> static assert(t2[1](0) == 0); // OK
> foreach (t; t2) {} // Error
> }
>
>
> Is this expected, a bug in my code, a known bug in DMD, a new DMD bug, a limitation meant to be removed, etc?
>
> Bye,
> bearophile
Maybe you can try something like typeof(t2) in the foreach.
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list