|
Archives
D Programming
digitalmars.Ddigitalmars.D.bugs digitalmars.D.dtl digitalmars.D.ide digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger D.gnu D C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
digitalmars.D.learn - Class allocation from tuple
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
May 21 2009
On Thu, May 21, 2009 at 10:31 AM, bearophile <bearophileHUGS lycos.com> wro= te:I have a tuple of classes (D1 language), I'd like to instantiate one of t= May 21 2009
Jarrett Billingsley:When it tries to parse the type following 'new', it interprets the brackets as meaning an array type,< May 21 2009
On Thu, May 21, 2009 at 11:13 AM, bearophile <bearophileHUGS lycos.com> wrote:Jarrett Billingsley:When it tries to parse the type following 'new', it interprets the brackets as meaning an array type,< May 21 2009
bearophile wrote: May 21 2009
|