Public template types

bearophile bearophileHUGS at lycos.com
Sun Nov 3 15:27:31 PST 2013


Sometimes I have to make a template type argument visible inside 
the instantiated type:


struct Foo(T_) {
     alias T = T_;
}
void main() {
     Foo!int f;
     static assert(is(f.T == int));
}


A little of syntax sugar could do the same, avoiding the need for 
a new name as "T_":

struct Foo(public T) {}

Do you like?

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list