-// VC++ before 7.1 does not have partial template specialization
-#ifdef __VISUALC__
- #if __VISUALC__ < 1310
- #define HAVE_NO_PARTIAL_SPECIALIZATION
- #endif
-#endif
-
-#if defined(HAVE_DYNAMIC_CAST) && !defined(HAVE_NO_PARTIAL_SPECIALIZATION)
- // A structure to cast to wxTrackableBase, using either static_cast<> or dynamic_cast<>.
- template<class T,bool is_static>
- struct wxTrackableCaster;
-
- template <class T>
- struct wxTrackableCaster<T,true> {
- static wxTrackableBase* Cast(T* pt){ return static_cast<wxTrackableBase*>(pt); }
- };
-
- template <class T>
- struct wxTrackableCaster<T,false> {
- static wxTrackableBase* Cast(T* pt){ return dynamic_cast<wxTrackableBase*>(pt); }
- };
-#else
- #if defined(HAVE_DYNAMIC_CAST)
- // If we have dynamic_cast, default to that. For gcc, dynamic_cast<> does the job
- // of both the dynamic and the static case. It could be that all compilers do it
- // that way, rendering the specialization code above rednundant.
- template <class T,bool is_static>
- struct wxTrackableCaster {
- static wxTrackableBase* Cast(T* pt){ return dynamic_cast<wxTrackableBase*>(pt); }
- };
- #else
- // No dynamic_cast<> is available.
- // We use static_cast<>, that gives support for wxEvtHandler and wxWindow references.
- // We don't get weak refs to other wxObject derived types.
- template <class T,bool is_static>
- struct wxTrackableCaster {
- static wxTrackableBase* Cast(T* pt){ return static_cast<wxTrackableBase*>(pt); }
- };
- #endif
-#endif