summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qvarlengtharray.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qvarlengtharray.h')
-rw-r--r--src/corelib/tools/qvarlengtharray.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h
index 95cd0447d8..90b54b7297 100644
--- a/src/corelib/tools/qvarlengtharray.h
+++ b/src/corelib/tools/qvarlengtharray.h
@@ -91,6 +91,15 @@ public:
return *this;
}
+#ifdef Q_COMPILER_INITIALIZER_LISTS
+ QVarLengthArray<T, Prealloc> &operator=(std::initializer_list<T> list)
+ {
+ resize(list.size());
+ std::copy(list.begin(), list.end(), this->begin());
+ return *this;
+ }
+#endif
+
inline void removeLast() {
Q_ASSERT(s > 0);
realloc(s - 1, a);