X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d05b30e40030a14423780d6723feee75b90eaf60..5cbda74b6606482f5286a5599fc60f3f91995a52:/include/wx/meta/movable.h diff --git a/include/wx/meta/movable.h b/include/wx/meta/movable.h index 7fc60d0bbf..a962282c42 100644 --- a/include/wx/meta/movable.h +++ b/include/wx/meta/movable.h @@ -11,7 +11,7 @@ #ifndef _WX_META_MOVABLE_H_ #define _WX_META_MOVABLE_H_ -#include "wx/defs.h" +#include "wx/meta/pod.h" #include "wx/string.h" // for wxIsMovable specialization // Helper to decide if an object of type T is "movable", i.e. if it can be @@ -21,8 +21,7 @@ template struct wxIsMovable { - // NB: enum, because VC6 can't handle "static const bool value = true;" - enum { value = false }; + wxDEFINE_TEMPLATE_BOOL_VALUE(wxIsPod::value); }; // Macro to add wxIsMovable specialization for given type that marks it @@ -30,56 +29,17 @@ struct wxIsMovable #define WX_DECLARE_TYPE_MOVABLE(type) \ template<> struct wxIsMovable \ { \ - enum { value = true }; \ + wxDEFINE_TEMPLATE_BOOL_VALUE(true); \ }; -WX_DECLARE_TYPE_MOVABLE(bool) -WX_DECLARE_TYPE_MOVABLE(unsigned char) -WX_DECLARE_TYPE_MOVABLE(signed char) -WX_DECLARE_TYPE_MOVABLE(unsigned int) -WX_DECLARE_TYPE_MOVABLE(signed int) -WX_DECLARE_TYPE_MOVABLE(unsigned short int) -WX_DECLARE_TYPE_MOVABLE(signed short int) -WX_DECLARE_TYPE_MOVABLE(signed long int) -WX_DECLARE_TYPE_MOVABLE(unsigned long int) -WX_DECLARE_TYPE_MOVABLE(float) -WX_DECLARE_TYPE_MOVABLE(double) -WX_DECLARE_TYPE_MOVABLE(long double) -#if wxWCHAR_T_IS_REAL_TYPE -WX_DECLARE_TYPE_MOVABLE(wchar_t) -#endif -#ifdef wxLongLong_t -WX_DECLARE_TYPE_MOVABLE(wxLongLong_t) -WX_DECLARE_TYPE_MOVABLE(wxULongLong_t) -#endif - -// Visual C++ 6.0 can't compile partial template specializations and as this is -// only an optimization, we can live with pointers not being recognized as -// movable types under VC6 -#if !wxCHECK_VISUALC_VERSION(7) - -// pointers are movable: -template -struct wxIsMovable -{ - enum { value = true }; -}; -template -struct wxIsMovable -{ - enum { value = true }; -}; - -#endif // !VC++ < 7 - // Our implementation of wxString is written in such way that it's safe to move -// it around. OTOH, we don't know anything about std::string. +// it around (unless position cache is used which unfortunately breaks this). +// OTOH, we don't know anything about std::string. // (NB: we don't put this into string.h and choose to include wx/string.h from // here instead so that rarely-used wxIsMovable code isn't included by // everything) -#if !wxUSE_STL +#if !wxUSE_STD_STRING && !wxUSE_STRING_POS_CACHE WX_DECLARE_TYPE_MOVABLE(wxString) #endif - #endif // _WX_META_MOVABLE_H_