X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e5d92e2bef8fed2f3fabaf9662902eb7189f5f92..169adfa9c4b781f737920bc808da91cd926c3e36:/include/wx/defs.h diff --git a/include/wx/defs.h b/include/wx/defs.h index 2e933f17d0..18a82b4c68 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -309,9 +309,24 @@ typedef int wxWindowID; } #define wx_truncate_cast(t, x) wx_truncate_cast_impl(x) -#else /* !__INTELC__ */ + +#elif defined(__cplusplus) && defined(__VISUALC__) && __VISUALC__ >= 1310 + template + inline T wx_truncate_cast_impl(X x) + { + #pragma warning(push) + /* conversion from 'X' to 'T', possible loss of data */ + #pragma warning(disable: 4267) + + return x; + + #pragma warning(pop) + } + + #define wx_truncate_cast(t, x) wx_truncate_cast_impl(x) +#else #define wx_truncate_cast(t, x) ((t)(x)) -#endif /* __INTELC__/!__INTELC__ */ +#endif /* for consistency with wxStatic/DynamicCast defined in wx/object.h */ #define wxConstCast(obj, className) wx_const_cast(className *, obj)