knowL: Knowledge Libraries
Loading...
Searching...
No Matches
WeakReference.h
1#include <QWeakPointer>
2
3namespace knowCore
4{
5 template<typename _TOwner_>
6 class WeakReference;
7 template<typename _TOwner_>
8 inline uint qHash(const WeakReference<_TOwner_>& key, uint seed = 0);
16 template<typename _TOwner_>
18 {
19 friend _TOwner_;
20 friend uint qHash<>(const WeakReference<_TOwner_>&, uint);
21 public:
22 WeakReference() {}
23 WeakReference(const _TOwner_& _t) : d(_t.d) {}
24 bool operator==(const WeakReference<_TOwner_>& _rhs) const { return d == _rhs.d; }
25 private:
26 QWeakPointer<typename _TOwner_::Private> d;
27 };
28 template<typename _TOwner_>
29#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
30 inline uint qHash(const WeakReference<_TOwner_>& key, uint seed) { return ::qHash(key.d.data(), seed); }
31#else
32 inline uint qHash(const WeakReference<_TOwner_>& key, uint seed) { return ::qHash(key.d.toStrongRef().data(), seed); }
33#endif
34}
Definition WeakReference.h:18