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

Reconsider a condition check for the data structure selection of the QList class

    XMLWordPrintable

Details

    • All

    Description

      I have taken a closer look at the available information for the QList class once more.

      Documentation:
      “…, where QList<T> will allocate its items on the heap unless sizeof(T) <= sizeof(void*) …”

      I would expect that all items will be put on the heap because items for stack storage should have got a fixed size. But this class belongs to the category of enlargeable data structures. (A bit of fixed management data can eventually be stored on the stack.)

      The current source code contains the following information.

      struct MemoryLayout
      …
                  QTypeInfo<T>::isStatic || QTypeInfo<T>::isLarge,
                  QListData::IndirectLayout,
                  typename std::conditional<
                      sizeof(T) == sizeof(void*),
                      QListData::ArrayCompatibleLayout,
                      QListData::InlineWithPaddingLayout
                   >::type>::type {};
      …
      

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            elfring Markus Elfring
            Maurice Kalinowski Maurice Kalinowski
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes