the sizeof "internal class" ... a question to C++ gurus

From: Jacek M. Holeczek <holeczek_at_us.edu.pl>
Date: Thu, 20 Jan 2005 15:04:36 +0100 (MET)


Hi,
I've got a stupid C++ question ...

Assume there are two templated classes "MyTemplate1<MyClass1>" and "MyTemplate2<MyClass2>" ...

Is there any possibility to get informations about the internal "MyClass1" from inside of the "MyTemplate2<MyTemplate1<MyClass1>>" ?

In principle, in the "MyTemplate2" I would like to create an array :

        MyClass1 internal_array[(sizeof(MyTemplate1<MyClass1>) / sizeof(MyClass1))];

In other words ... inside of "MyTemplate2" I would like to "generate" ... 1. for ... MyTemplate2<float> ... :

        float internal_array[1];
2. for ... MyTemplate2<double> ... :

        double internal_array[1];
3. for ... MyTemplate2<MyTemplate1<float>> ... :

        float internal_array[(sizeof(MyTemplate1<float>) / sizeof(float))]; 4. for ... MyTemplate2<MyTemplate1<double>> ... :

        double internal_array[(sizeof(MyTemplate1<double>) / sizeof(double))];

Thanks in advance,
Best regards,
Jacek. Received on Thu Jan 20 2005 - 15:04:46 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:04 MET