I am familiar with how Qt uses D pointers to manipulate data. How to do this in my code?
I tried this method:
1) move all the data to the structure 2) add QAtomicInt to the structure 3) implement the a = operator and change its constructor / deconstructor to check the number of links.
The problem is that when I go to make a shallow copy of the object, I get the error message QObject = private. How am I going to do this?
Here is an example of my copy statement:
HttpRequest & HttpRequest::operator=(const HttpRequest &other) { other.d->ref.ref(); if (!d->ref.deref()) delete d; d = other.d; return *this; }
Am I going about it wrong?
source share