diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-04-19 22:45:06 +0200 |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-09-03 12:57:24 +0200 |
commit | c22d43237363463e3409286470392a3227f49961 (patch) | |
tree | 9c1929a796ae8175242a7d6baf359592b52b3339 /src/corelib/tools/qlist.h | |
parent | da0e1a682362144b9f13b4c564f86e09efb681bb (diff) |
C++0x: being able to create a list with the {,,,} notation
Reviewed-by: Joao
Diffstat (limited to 'src/corelib/tools/qlist.h')
-rw-r--r-- | src/corelib/tools/qlist.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index b1d07bdb3c..8f988d60a2 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -50,6 +50,10 @@ #include <iterator> #include <list> #endif +#ifdef Q_COMPILER_INITIALIZER_LISTS +#include <iterator> +#include <initializer_list> +#endif #include <new> #include <limits.h> @@ -122,6 +126,10 @@ public: inline QList &operator=(QList &&other) { qSwap(d, other.d); return *this; } #endif +#ifdef Q_COMPILER_INITIALIZER_LISTS + inline QList(std::initializer_list<T> args) : d(&QListData::shared_null) + { d->ref.ref(); qCopy(args.begin(), args.end(), std::back_inserter(*this)); } +#endif bool operator==(const QList<T> &l) const; inline bool operator!=(const QList<T> &l) const { return !(*this == l); } |