Why can't structs be derived from?

Max Samukha max at spam.box
Wed Mar 16 01:35:14 PDT 2011


On 03/16/2011 04:28 AM, bearophile wrote:
> Daniel Gibson:
>
>> This check may make sense, but this cast could even work on
>> pointers-to-structs if they are similar, something like
>
> I suggest to keep purposes separated, to keep the semantics of the program cleaner and to avoid some bugs, letting staticCast work with just objects.
>
> A different function is for structs, that tests the first fields of the second struct are all present in the same order in the first struct :-)
>
> Bye,
> bearophile

QtD's static_cast is not part of the public API. It is an internal 
helper function that was supposed to be simple and hacky.


More information about the Digitalmars-d mailing list