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

        For Gerrit Dashboard: QTBUG-37750
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            thiago Thiago Macieira
            Reporter:
            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