diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-08-17 14:54:44 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-08-17 14:54:44 (GMT) |
commit | 46a33725125f0b5408fd421ae8fd9f4c76a123ab (patch) | |
tree | 5df2038ecc5225377fbbdb2aa9da4e68acafae56 /src/corelib/global | |
parent | ba25514d1c1010d84ffdbf75331ff71596e56c99 (diff) | |
parent | ac9f56b31dacc35dd2007caee69a9cf521ed8410 (diff) | |
download | Qt-46a33725125f0b5408fd421ae8fd9f4c76a123ab.zip Qt-46a33725125f0b5408fd421ae8fd9f4c76a123ab.tar.gz Qt-46a33725125f0b5408fd421ae8fd9f4c76a123ab.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into qtscript-jsc-backend
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qglobal.h | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 5a2c329..92fe649 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1906,6 +1906,14 @@ public: \ static inline const char *name() { return #TYPE; } \ } +template <typename T> +inline void qSwap(T &value1, T &value2) +{ + const T t = value1; + value1 = value2; + value2 = t; +} + /* Specialize a shared type with: @@ -1915,33 +1923,12 @@ public: \ types must declare a 'bool isDetached(void) const;' member for this to work. */ -#if defined Q_CC_MSVC && _MSC_VER < 1300 -template <typename T> -inline void qSwap_helper(T &value1, T &value2, T*) -{ - T t = value1; - value1 = value2; - value2 = t; -} #define Q_DECLARE_SHARED(TYPE) \ template <> inline bool qIsDetached<TYPE>(TYPE &t) { return t.isDetached(); } \ -template <> inline void qSwap_helper<TYPE>(TYPE &value1, TYPE &value2, TYPE*) \ -{ \ - const TYPE::DataPtr t = value1.data_ptr(); \ - value1.data_ptr() = value2.data_ptr(); \ - value2.data_ptr() = t; \ -} -#else -#define Q_DECLARE_SHARED(TYPE) \ -template <> inline bool qIsDetached<TYPE>(TYPE &t) { return t.isDetached(); } \ -template <typename T> inline void qSwap(T &, T &); \ template <> inline void qSwap<TYPE>(TYPE &value1, TYPE &value2) \ { \ - const TYPE::DataPtr t = value1.data_ptr(); \ - value1.data_ptr() = value2.data_ptr(); \ - value2.data_ptr() = t; \ + qSwap<TYPE::DataPtr>(value1.data_ptr(), value2.data_ptr()); \ } -#endif /* QTypeInfo primitive specializations |