Implement wx_truncate_cast for VC++ 7.1 and later
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35896 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
e5d92e2bef
commit
c1b6178278
@ -309,9 +309,24 @@ typedef int wxWindowID;
|
||||
}
|
||||
|
||||
#define wx_truncate_cast(t, x) wx_truncate_cast_impl<t>(x)
|
||||
#else /* !__INTELC__ */
|
||||
|
||||
#elif defined(__cplusplus) && defined(__VISUALC__) && __VISUALC__ >= 1310
|
||||
template <typename T, typename X>
|
||||
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<t>(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)
|
||||
|
Loading…
Reference in New Issue
Block a user