26 The purpose of this class is to give an opportunity to programmers to replace the useless "std::bad_cast" thrown when performing a "dynamic_cast<To &>(obj)". This class will catch the exception, wrap it up with lots more info, then re-throw an exception_type derived from Excpt and std::bad_cast. For example it will give:
27
28 1. The class types cast from and to.
29 2. The address of the object on which the cast was attempted.
30 3. The file and line of where the check was done. (So you can more easily track down the errors!)
31 4. Extra potentially handy info.
32 */
33template<
34typename To,
35class Excpt=crt_exception<ppd::platform_api, ppd::heavyweight_threading> ///< Re-throw an exception_type derived from this type and std::bad_cast.
40 So that you can still catch this type with your unaltered catches of std::bad_cast, but better to alter them so that you can get at the greater info that is provided.
71/// Use the macro "JMMCG_CHK_DYNAMIC_CAST(To, obj)" as your drop-in replacement for where you'd place statements like: "To &a=dynamic_cast<To>(obj);". Note that this macro cannot replace expression forms.