Thomas Maeder wrote:
> ...
> You could of course write a little function template that
> - invokes dynamic_cast if source and destination types are different
> - produces a compiler error if both types are equal
> 
> and use that function template instead of dynamic_cast.

That was a good idea. Now I am using such a template function.

In future I plan to replace all dynamic_cast<>s by such functions:
a) "instance_of<>" for tests, where the result of dynamic_cast<> was
   used to test.
b) "assert_cast<>" for real conversions during runtime. This function
   will throw an exception if the cast fails.

Thank you!
Andreas
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to