GLib/GObject+C as the lingua franca?
nf2
nf2 at scheinwelt.at
Wed Jul 30 17:08:07 BST 2008
Thiago Macieira wrote:
>>
>>> If you want copiable things, use pointers. I'm implementing a generic
>>> pointer-holding class with atomic reference-counting for Qt 4.5, so
>>> you don't have to write anything.
>>>
>> That's cool. Taking the above example, would something like this be
>> possible?
>>
>> QList<QRefCountedPointer<QMount>> VolumeMonitor::getMounts()
>>
>
> Yes.
>
Will the refcounter be inside QObject or inside the pointer-holding class?
Because in the latter case you would loose the refcount as soon as you
just pass the pointer to a function or try to cast the pointer:
QRefCountedPointer<A> a = new A();
call_some_function(a.p);
or
QRefCountedPointer<B> = dynamic_cast<B*> a.p;
Norbert
More information about the kde-core-devel
mailing list