Results 1 to 2 of 2

Thread: QScopedPointer usage with Forward Declaration

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2008
    Posts
    19
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    4
    Thanked 3 Times in 2 Posts

    Default Re: QScopedPointer usage with Forward Declaration

    From the Qt documentation

    Classes that are forward declared can be used within QScopedPointer, as long as the destructor of the forward declared class is available whenever a QScopedPointer needs to clean up.

    Concretely, this means that all classes containing a QScopedPointer that points to a forward declared class must have non-inline constructors, destructors and assignment operators
    I believe the issue is the compiler will implicitly define a default constructor in places where your type is still incomplete causing the error.

  2. The following 2 users say thank you to peppermg for this useful post:

    ca (12th February 2021), d_stranz (11th February 2021)

Similar Threads

  1. Forward declaration fails
    By [?]jNs in forum Newbie
    Replies: 5
    Last Post: 27th July 2011, 11:28
  2. Forward Declaration of struct QCloseEvent ????
    By drake1983 in forum Newbie
    Replies: 2
    Last Post: 3rd February 2009, 15:16
  3. problem with forward declaration
    By MarkoSan in forum General Programming
    Replies: 14
    Last Post: 6th January 2008, 21:45
  4. Forward declaration with std namespace
    By Raistlin in forum General Programming
    Replies: 2
    Last Post: 5th March 2007, 20:45
  5. Why forward declaration ?
    By probine in forum General Programming
    Replies: 3
    Last Post: 26th January 2007, 18:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.