From d3659bf88bac8dbfcdc6c957bdcc25e29bef0f04 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 18 Mar 2015 09:28:59 +0100 Subject: QVarLengthArray: Add initializer_list constructor Implement an initializer_list constructor, which was probably just forgotten so far. Technically this is a SC incompatible change, since QVarLengthArray array = {10}; will now create an array with one element 10, instead of an empty array with a reserved size of 10. Anyhow, keeping the inconsistency with the STL / other Qt containers here would certainly do more harm than good in the long run. Task-number: QTBUG-45047 Change-Id: I4675880f93e141181250939942fa32300916b0e3 Reviewed-by: Marc Mutz --- src/corelib/tools/qvarlengtharray.qdoc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/corelib/tools/qvarlengtharray.qdoc') diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc index 6cc9f62c5a..d1b87f381e 100644 --- a/src/corelib/tools/qvarlengtharray.qdoc +++ b/src/corelib/tools/qvarlengtharray.qdoc @@ -100,6 +100,17 @@ \l{default-constructed value}. */ + +/*! \fn QVarLengthArray::QVarLengthArray(std::initializer_list args) + \since 5.5 + + Constructs an array from the std::initializer_list given by \a args. + + This constructor is only enabled if the compiler supports C++11 initializer + lists. +*/ + + /*! \fn QVarLengthArray::~QVarLengthArray() Destroys the array. -- cgit v1.2.3