diff options
Diffstat (limited to 'src/core/resources/qresourcemanager_p.h')
-rw-r--r-- | src/core/resources/qresourcemanager_p.h | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/src/core/resources/qresourcemanager_p.h b/src/core/resources/qresourcemanager_p.h index ba39695a4..6e479d5ef 100644 --- a/src/core/resources/qresourcemanager_p.h +++ b/src/core/resources/qresourcemanager_p.h @@ -179,19 +179,7 @@ private: template <typename T> struct QResourceInfo { - enum - { - needsCleanup = false - }; -}; - -template <> -struct QResourceInfo<void> -{ - enum - { - needsCleanup = false - }; + static const bool needsCleanup = false; }; enum @@ -204,22 +192,10 @@ enum template<> \ struct QResourceInfo<TYPE > \ { \ - enum \ -{ \ - needsCleanup = ((FLAGS & Q_REQUIRES_CLEANUP) == 0) \ -}; \ + static const bool needsCleanup = (FLAGS & Q_REQUIRES_CLEANUP) == 0;\ }; \ } // namespace Qt3DCore -template <int v> -struct Int2Type -{ - enum - { - value = v - }; -}; - template<typename T> class QHandleData : public QHandle<T>::Data { @@ -275,7 +251,7 @@ public: typename Handle::Data *d = handle.data_ptr(); d->nextFree = freeList; freeList = d; - performCleanup(&static_cast<QHandleData<T> *>(d)->data, Int2Type<QResourceInfo<T>::needsCleanup>()); + performCleanup(&static_cast<QHandleData<T> *>(d)->data, std::integral_constant<bool, QResourceInfo<T>::needsCleanup>{}); } T *data(Handle h) @@ -349,13 +325,16 @@ private: } } - void performCleanup(T *r, Int2Type<true>) + template<typename Q = T> + void performCleanup(Q *r, std::integral_constant<bool, true>) { r->cleanup(); } - void performCleanup(T *, Int2Type<false>) - {} + template<typename Q = T> + void performCleanup(Q *, std::integral_constant<bool, false>) + { + } }; |