Why can't structs be derived from?

bearophile bearophileHUGS at lycos.com
Tue Mar 15 18:01:39 PDT 2011


Andrej Mitrovic:

> I've spotted this in QtD's codebase, dunno if this works:
> 
> T static_cast(T, U)(U obj)
> {
>     return cast(T)cast(void*)obj;
> }

See this thread, it contains a better implementation of staticCast (partially written by me), that I'd like in Phobos:
http://www.digitalmars.com/d/archives/digitalmars/D/learn/Dynamic_and_Static_Casting_24524.html

Bye,
bearophile


More information about the Digitalmars-d mailing list