One question about templates
bearophile
bearophileHUGS at lycos.com
Wed Aug 4 18:23:58 PDT 2010
How can I tell that S1 and S2 are different instantiations of the same struct template, while Bar is an instantiation of a different struct template?
struct Foo(T...) {}
struct Bar(T...) {}
template SameStructTemplate(S1, S2) {
// enum bool SameStructTemplate = ?
}
void main() {
alias Foo!(int,int,int) S1;
alias Foo!(float,int,int,int) S2;
alias Bar!(float,int,int,int) S3;
static assert(SameStructTemplate!(S1, S2));
static assert(!SameStructTemplate!(S1, S3));
}
Bye and thank you,
bearophile
More information about the Digitalmars-d-learn
mailing list