Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Forward declaration of QExplicitlySharedDataPointer<T>
Forum Updated to NodeBB v4.3 + New Features

Forward declaration of QExplicitlySharedDataPointer<T>

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 567 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    linolium
    wrote on last edited by
    #1

    Hi,

    I have started converting many of the C++ classes in my application to QExplicitlySharedDataPointer<T> in order to avoid using raw pointers which became unmanageable as the application grew in size. My implementation is based on Qt's documentation http://doc.qt.io/qt-5/qshareddatapointer.html. Hence split up each class into 2 classes: a data class which holds the member variables and another class that holds the QExplicitlySharedDataPointer and the member methods.

    Using raw pointers it was possible to use forward declarations in the header files which had some significant advantages over includes:

    • Avoid circular include dependencies
    • Do not recompile everything when a header file is modified

    Unfortunately I don't know how to forward declare a class that uses QExplicitlySharedDataPointer<T>, so I am using includes for now which deteriorates compile time and brings back the issue of circular include dependencies.

    So my question is whether it is possible to forward declare a class that uses QExplicitlySharedDataPointer<T> and how?

    raven-worxR 1 Reply Last reply
    0
    • L linolium

      Hi,

      I have started converting many of the C++ classes in my application to QExplicitlySharedDataPointer<T> in order to avoid using raw pointers which became unmanageable as the application grew in size. My implementation is based on Qt's documentation http://doc.qt.io/qt-5/qshareddatapointer.html. Hence split up each class into 2 classes: a data class which holds the member variables and another class that holds the QExplicitlySharedDataPointer and the member methods.

      Using raw pointers it was possible to use forward declarations in the header files which had some significant advantages over includes:

      • Avoid circular include dependencies
      • Do not recompile everything when a header file is modified

      Unfortunately I don't know how to forward declare a class that uses QExplicitlySharedDataPointer<T>, so I am using includes for now which deteriorates compile time and brings back the issue of circular include dependencies.

      So my question is whether it is possible to forward declare a class that uses QExplicitlySharedDataPointer<T> and how?

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @linolium said in Forward declaration of QExplicitlySharedDataPointer<T>:

      So my question is whether it is possible to forward declare a class that uses QExplicitlySharedDataPointer<T> and how?

      Forward declaration of templated classes:

      template <class T>
      QExplicitlySharedDataPointer;
      

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      4

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved