Class References

Baz burg.basile at yahoo.fr
Fri Nov 22 09:16:33 PST 2013


On Monday, 28 October 2013 at 11:22:03 UTC, Jeroen Bollen wrote:
> Is it possible in D to create an enum of class references?
> Something around the lines of:
>
> enum ClassReferences : Interface {
>     CLASS1 = &ClassOne,
>     CLASS2 = &ClassTwo
> }

at runtime make an array of *void and cast them according to a 
type tuple.

at compile time, it's another philosophy: you gotta use TMP. 
Confere with 
http://stackoverflow.com/questions/15302514/are-there-metaclasses-or-class-reference-in-d/15303118#15303118 
.

Because the reference to a class type (it's a compile-time stuff) 
can be interpreted by using template meta programming (also a 
compile-time stuff).It's just another language philosophy but the 
result at the run-time is the same (about this case).




More information about the Digitalmars-d-learn mailing list