QSet/QQueue/QStack: use compiler-generated special member functions
They do the right thing (except move special member functions on MSVC, but that's MSVC's problem). Change-Id: I699e1be83c0568821f8c6b84394a2713bb22e8e7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
46c5b86612
commit
5c44232122
@ -916,6 +916,9 @@ public:
|
||||
insert(it->first, it->second);
|
||||
}
|
||||
#endif
|
||||
// compiler-generated copy/move ctors/assignment operators are fine!
|
||||
// compiler-generated destructor is fine!
|
||||
|
||||
QMultiHash(const QHash<Key, T> &other) : QHash<Key, T>(other) {}
|
||||
void swap(QMultiHash &other) { QHash<Key, T>::swap(other); } // prevent QMultiHash<->QHash swaps
|
||||
|
||||
|
@ -43,8 +43,7 @@ template <class T>
|
||||
class QQueue : public QList<T>
|
||||
{
|
||||
public:
|
||||
inline QQueue() {}
|
||||
inline ~QQueue() {}
|
||||
// compiler-generated special member functions are fine!
|
||||
inline void swap(QQueue<T> &other) { QList<T>::swap(other); } // prevent QList<->QQueue swaps
|
||||
#ifndef Q_QDOC
|
||||
// bring in QList::swap(int, int). We cannot say using QList<T>::swap,
|
||||
|
@ -57,15 +57,9 @@ public:
|
||||
insert(*it);
|
||||
}
|
||||
#endif
|
||||
inline QSet(const QSet<T> &other) : q_hash(other.q_hash) {}
|
||||
// compiler-generated copy/move ctor/assignment operators are fine!
|
||||
// compiler-generated destructor is fine!
|
||||
|
||||
inline QSet<T> &operator=(const QSet<T> &other)
|
||||
{ q_hash = other.q_hash; return *this; }
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
inline QSet(QSet &&other) : q_hash(qMove(other.q_hash)) {}
|
||||
inline QSet<T> &operator=(QSet<T> &&other)
|
||||
{ qSwap(q_hash, other.q_hash); return *this; }
|
||||
#endif
|
||||
inline void swap(QSet<T> &other) { q_hash.swap(other.q_hash); }
|
||||
|
||||
inline bool operator==(const QSet<T> &other) const
|
||||
|
@ -43,8 +43,7 @@ template<class T>
|
||||
class QStack : public QVector<T>
|
||||
{
|
||||
public:
|
||||
inline QStack() {}
|
||||
inline ~QStack() {}
|
||||
// compiler-generated special member functions are fine!
|
||||
inline void swap(QStack<T> &other) { QVector<T>::swap(other); } // prevent QVector<->QStack swaps
|
||||
inline void push(const T &t) { QVector<T>::append(t); }
|
||||
T pop();
|
||||
|
Loading…
Reference in New Issue
Block a user