[Qt-interest] Problem with implicit sharing of a QCache object

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Thu Jul 15 08:29:11 CEST 2010


Hi All,

I'm using QCache in my app to store some frequently used data (images).

I experienced a problem when trying to assign a QCache object (passed
to me in a function, as reference) to a local QCache var in my class.
The compiler cribbed saying that the "= operator" was declared
private.

Now QCache is listed under the list of classes that support QT's
"implicit sharing". So, doesn't that require the class (QCache in my
case) to support the copy constructor? Or is there any other way
implicit sharing is done for QCache?

QCache code explicitly disables the copy constructor, using
Q_DISABLE_COPY(QCache).

So right now with this restriction, I'll have to accept a pointer to
the cache from outside (rather than receiving it by ref/value, which I
was hoping to avoid).

Regards,
-mandeep



More information about the Qt-interest-old mailing list