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

Provide placement new-style construction of meta-types

    XMLWordPrintable

    Details

    • Technical Risk:
      Normal
    • Commits:
      9e92ecde74d33eddd39de88472964fb20feaaebf

      Description

      Currently, the two ways of constructing a meta-type instance are

      1) QVariant(int type, void *copy = 0). This will use QVariant::Private::Data to store the data if the type fits, and will heap-allocate otherwise; or

      2) void *QMetaType::construct(int type, void *copy = 0). This will always heap-allocate.

      It should be possible to construct a meta-type by passing a type id and the address of where to construct the new instance. This would make it possible to construct any meta-type on the stack, or to allocate the type using a custom memory pool. For 1) it also avoids the overhead of invoking the QVariant constructor and destructor. This is important in order to make QtScript's QObject bindings perform better (currently every slot call or property access from QtScript creates one or more variants to hold the converted JS arguments & return value).

        Attachments

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

          Activity

            People

            Assignee:
            kenthans Kent Hansen (Inactive)
            Reporter:
            kenthans Kent Hansen (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes