Class allocation from tuple
bearophile
bearophileHUGS at lycos.com
Thu May 21 07:31:14 PDT 2009
I have a tuple of classes (D1 language), I'd like to instantiate one of them directly with new, but it seems I can't:
template Tuple(T...) { alias T Tuple; }
class Foo { static void foo(){} }
class Bar {}
alias Tuple!(Foo, Bar) ClassTuple;
void main() {
alias ClassTuple[0] Foo0;
new Foo0; // OK
ClassTuple[0].foo(); // OK
new ClassTuple[0]; // Not OK
new (ClassTuple[0]); // Not OK
}
Can you tell me what the problem is?
Thank you and bye,
bearophile
More information about the Digitalmars-d-learn
mailing list