May 06, 2004 Missing typeinfo | ||||
---|---|---|---|---|
| ||||
I can not get the typeinfo from array of arrays in Java Arrays are object so int[][].getClass() returns class of Object[] (whose contained class is int[]) I think the D typeinfo should follow a similar model there should be a typeinfo for 'Array of T' so T[][] is array of (T[]) (R being T[]) int[].typeinfo => TypeInfo_R; TypeInfo_R.contained => TypeInfo_int; int[][].typeinfo => TypeInfo_R; TypeInfo_R.contained => TypeInfo_R; TypeInfo_R.contained => TypeInfo_int; or int[].typeinfo => TypeInfo_Rint; TypeInfo_Rint.contained => TypeInfo_int; int[][].typeinfo => TypeInfo_R; TypeInfo_R.contained => TypeInfo_Rint; etc. --------------------------------------------- import std.c.stdio; template typename(T) { static int getinfo() { return cast(int)cast(void*)T.typeinfo; } } class Foo { } int main( char[][] args ) { printf( "(Foo[]).typeinfo=0x%X\n", typename!(Foo[]).getinfo ); printf( "(Foo[][]).typeinfo=0x%X\n", typename!(Foo[][]).getinfo ); return 0; } // Error 42: Symbol Undefined __init_12TypeInfo_AAC |
May 19, 2004 Re: Missing typeinfo | ||||
---|---|---|---|---|
| ||||
Posted in reply to one_mad_alien | I need to reengineer the typeinfo stuff. |
Copyright © 1999-2021 by the D Language Foundation