diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-08-04 23:57:51 -0300 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2014-08-09 09:05:43 +0200 |
commit | dcf9883dffc88355402e5697f0572e5241e1c062 (patch) | |
tree | e7a9d1d2edfd7f9c3210f8dbe8ac2697a3397125 /src/corelib/tools/qlist.h | |
parent | 2431bf1b20e2815e0da3d294cce129de775b8f39 (diff) |
Move the special QByteArrayList methods into QList
and make QByteArrayList be a simple typedef.
As a side-effect, the constructor taking a QByteArray is no longer
available since I couldn't find a way to add it to QList<T> when T is
QByteArray. My template-foo failed me. I tried:
- QEnableIf<is_same<T, QByteArray>::value, QByteArray>::type
=> makes QList fail to compile for any T that isn't QByteArray
- make the constructor a template member
=> it compiles if the parameter is a QByteArray, but not a const
char[4] like the test was
- inheriting constructors
=> runs into ICC and Clang bugs that I could not work around
Besides, the constructor with std::initializer_list is a superior
solution anyway.
Change-Id: Ic86fbadc1104142bfd907a5c4147199bf839fb89
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Diffstat (limited to 'src/corelib/tools/qlist.h')
-rw-r--r-- | src/corelib/tools/qlist.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 39c1c46f6e..6e0634ac3b 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -70,6 +70,9 @@ QT_BEGIN_NAMESPACE template <typename T> class QVector; template <typename T> class QSet; +template <typename T> struct QListSpecialMethods { }; +template <> struct QListSpecialMethods<QByteArray>; + struct Q_CORE_EXPORT QListData { struct Data { QtPrivate::RefCount ref; @@ -102,7 +105,7 @@ struct Q_CORE_EXPORT QListData { }; template <typename T> -class QList +class QList : public QListSpecialMethods<T> { struct Node { void *v; #if defined(Q_CC_BOR) @@ -745,7 +748,7 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::detach_helper() template <typename T> Q_OUTOFLINE_TEMPLATE QList<T>::QList(const QList<T> &l) - : d(l.d) + : QListSpecialMethods<T>(l), d(l.d) { if (!d->ref.ref()) { p.detach(d->alloc); @@ -952,6 +955,8 @@ Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(List) QT_END_NAMESPACE +#include <QtCore/qbytearraylist.h> + #ifdef Q_CC_MSVC #pragma warning( pop ) #endif |