Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-37750

QByteArray::reserve shows unexpected behaviour

    XMLWordPrintable

Details

    Description

      QByteArray shrinks its size, when its data is shared.
      When it's not shared it does nothing, like other containers, too.

      QByteArray test("0123456789");
      QByteArray copy = test;
      copy.reserve(5);
      test.reserve(5);
      qDebug() << "test: " << test;
      qDebug() << "copy: " << copy;
      

      Output:

      test:  "0123456789" 
      copy:  "01234" 
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            martinpley Martin Pley
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes