On Saturday, 20 July 2013 at 18:27:23 UTC, JS wrote:
is there any way to pass t directly to A?

template A(T...) doesn't seem work nor does using an alias. (or at least, when I try to foreach over it, it doesn't work).

template A(size_t L) {
    enum A = L;
}

template B(T...) {
void B(T b) {
    import std.stdio;
    foreach(Type; T) {
        pragma(msg, Type.stringof);
    }
    foreach(v; b) {
        writeln(v);
    }
}}

void foo(T...)(string s, T t) {
    auto n = A!(t.length);
    B(t);// t is runtime information
         // T is compile time information
}

void main() {
    foo("x", 1, 2);
}

Reply via email to