[QString] Implicit Sharing
Solved
General and Desktop
-
Hello. In Qt doc there is line about QByteArray and QString implicit sharing. So the question is, will QString take the reference of the byte array allocated in the stack?
I have following code, it's reading string from stream ( which is read from network), assuming string len always > 0 and < 8192
QString CPacketReader::readString(QDataStream &s){ qint32 len = readInt(s); char buf[8192] = {0}; int read = s.readRawData(buf,len); return QString::fromLatin1(buf,read); }
Thank you.