Conditional Inheritance
Simen Kjaeraas
simen.kjaras at gmail.com
Sun Jul 14 02:49:47 PDT 2013
On 2013-07-14, 07:00, JS wrote:
> I need to conditionally inherit:
>
> interface A(T) : conditionallyInherit!(isBasicType!T, B);
>
> A!(double) will inherit B but A!(mytype) won't.
template conditionallyInherit(bool choice, T...) {
static if (choice) {
alias conditionallyInherit = T;
} else {
import std.typetuple : TypeTuple;
alias conditionallyInherit = TypeTuple!();
}
}
Should work.
--
Simen
More information about the Digitalmars-d-learn
mailing list