Hello Simen,
bearophile <[email protected]> wrote:
The fourth C++ version contains a line that I am am not even sure how
to translate to D (maybe there is a workaround with template
constraints): (void) static_cast<My_kind *>((Kind *) 0);
This is a static assert of sorts. Basically, the function will only
compile if Kind is a subtype of My_kind. In D, you would use
is( Kind : My_kind ), where Kind and My_Kind are interfaces
Here's mine ( 8/11 at compile-time, the remaining at runtime ):
http://ideone.com/6WlFJ
I don't think it's possible to make it better than that in D without,
as you say, for instance type states.
The given test as is might be all catchable but add loops and references
into the picture and I think it turns into the halting problem.
--
... <IXOYE><