summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qpair.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qpair.h')
-rw-r--r--src/corelib/tools/qpair.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/corelib/tools/qpair.h b/src/corelib/tools/qpair.h
index 501f2af3e6..4dc28f2d26 100644
--- a/src/corelib/tools/qpair.h
+++ b/src/corelib/tools/qpair.h
@@ -55,16 +55,30 @@ struct QPair
typedef T1 first_type;
typedef T2 second_type;
- QPair() : first(T1()), second(T2()) {}
+ QPair() : first(), second() {}
QPair(const T1 &t1, const T2 &t2) : first(t1), second(t2) {}
-
- QPair<T1, T2> &operator=(const QPair<T1, T2> &other)
- { first = other.first; second = other.second; return *this; }
+ // compiler-generated copy/move ctor/assignment operators are fine!
T1 first;
T2 second;
};
+// mark QPair<T1,T2> as complex/movable/primitive depending on the
+// typeinfos of the constituents:
+template<class T1, class T2>
+class QTypeInfo< QPair<T1, T2> >
+{
+public:
+ enum {
+ isComplex = QTypeInfo<T1>::isComplex || QTypeInfo<T2>::isComplex,
+ isStatic = QTypeInfo<T1>::isStatic || QTypeInfo<T2>::isStatic,
+ isLarge = sizeof(QPair<T1, T2>) > sizeof(void*),
+ isPointer = false,
+ isDummy = false,
+ sizeOf = sizeof(QPair<T1, T2>)
+ };
+};
+
template <class T1, class T2>
Q_INLINE_TEMPLATE bool operator==(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
{ return p1.first == p2.first && p1.second == p2.second; }