On Thursday, 1 August 2013 at 12:50:42 UTC, John Colvin wrote:
template a(T ...)
{
    void a(R r)
    {
        //want to get a tuple of
        //the members of T, each
        //instantiated with R.

        //do some RT stuff
    }
}

Is this possible?

Whatever I try, I keep running in to "cannot use local as parameter to non-global template" errors, which I understand is to do with context pointers However, this is all compile-time work based entirely on types, there should be no need for any context pointers.

A static foreach should do the trick. (code not actually tested)

void a(R r) //void? Not Tuple!T ?
{
    Tuple!T ret
    foreach(i, Type; T)
    {
        ret[i] = r;
    }
    return ret;
}

Is this what you want? This assumes that every member or T is a type, and not a name.

Reply via email to