title: Qt pointer check thread
body: <p>When creating a class Foo, it is common separate the implementation details/data into a private class FooPrivate.</p>
  
  <p><code>class Foo {
      FooPrivate* p;
      ...
  };</code></p>
  
  <p>As far as I can see there are 4 strategies to manage the memory of p;</p>
  
  <ol>
  <li>manually delete in destructor</li>
  <li>QObject hierarchy. Make both QObjects and pass Foo as parent to FooPrivate.</li>
  <li>Use QScopedPointer.</li>
  <li>Use a std smart pointer.</li>
  <li>Use QSharedDataPointer. (Useful for big objects you copy a lot)</li>
  </ol>
  
  <p>Best practices can apparently be found here (<a href="https://stackoverflow.com/questions/25250171/how-to-use-the-qts-pimpl-idiom">How to use the Qt&#39;s PIMPL idiom?</a>). However, my main question is this. Every QObject has an associated QObject::thread(). Is there a smart pointer that is also a QObject, and that can check its thread is equal to the current thread when it is dereferenced? This would be very useful in preventing threading bugs for me. Would it be possible to implement such a pointer?</p>