[Issue 2090] Cannot alias a tuple member which is a template instance

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 10 01:01:31 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2090





------- Comment #1 from samukha at voliacable.com  2008-05-10 03:01 -------
It may be not a blocker as a workaround exists:
----
template Tuple(A...)
{
    alias A Tuple;
}

template Bar()
{
    const s = "a bar";
}

char[] toString(size_t v)
{    
    char[] s;
    s ~= "                    ";
    size_t i = 1;

    do
    {
        s[s.length - i] = '0' + v % 10;
        i++;
        v /= 10;
    } while (v)

    return s[$ - i + 1..$];
}

alias Tuple!(void, Bar!()) tuple;
const i = 1;
mixin ("alias tuple[" ~ toString(i) ~ "] bar;");

static assert(bar.s == "a bar");

void main()
{
}
----


-- 



More information about the Digitalmars-d-bugs mailing list