QString: make insert_helper take the insertee by const-ref
Not all callers pass a view-type object: there are several call points passing a QVarLengthArray, which means the value ended up being copied. Introduced in 67108ef8db0b134908a88e2da7a533be98f0c796. Found by Coverity scan (CID 404702). Change-Id: I9671dee8ceb64aa9b9cafffd1742f9cda2131752 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
938dc34f94
commit
09f5bb9969
@ -2943,7 +2943,7 @@ QString &QString::operator=(QChar ch)
|
||||
T is a view or a container on/of QChar, char16_t, or char
|
||||
*/
|
||||
template <typename T>
|
||||
static void insert_helper(QString &str, qsizetype i, T toInsert)
|
||||
static void insert_helper(QString &str, qsizetype i, const T &toInsert)
|
||||
{
|
||||
auto &str_d = str.data_ptr();
|
||||
qsizetype difference = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user