From 1db3de6a1e09216aaf92b60fc167a7326c6a62d8 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 19 Mar 2015 17:13:22 +0100 Subject: QVLA: Add operator= for initializer lists Add a dedicated operator=(std::initializer_list) that first resizes the QCLA, and then replaces the elements one by one. This should be usually faster than creating a temporary QCLA and then copying it, except for the case where the new array does not fit into the allocated stack - but this is IMO nothing to optimize for. Task-number: QTBUG-45041 Change-Id: I147d6d01186b1ca3c635b2c8365d8f6e638ce6fe GPush-Base: 08de3113051e1289f0de0651ec5647c9ee6feb27 Reviewed-by: Marc Mutz Reviewed-by: Thiago Macieira --- src/corelib/tools/qvarlengtharray.qdoc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/corelib/tools/qvarlengtharray.qdoc') diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc index d1b87f381e..a2d4c55f7a 100644 --- a/src/corelib/tools/qvarlengtharray.qdoc +++ b/src/corelib/tools/qvarlengtharray.qdoc @@ -362,6 +362,15 @@ Assigns \a other to this array and returns a reference to this array. */ +/*! \fn QVarLengthArray &QVarLengthArray::operator=(std::initializer_list list) + \since 5.5 + + Assigns the values of \a list to this array, and returns a reference to this array. + + This constructor is only enabled if the compiler supports C++11 initializer + lists. +*/ + /*! \fn QVarLengthArray::QVarLengthArray(const QVarLengthArray &other) Constructs a copy of \a other. */ -- cgit v1.2.3