[Xapian-devel] Re: [Xapian-commits] 8107: trunk/xapian-core/
richard at lemurconsulting.com
Thu Apr 5 12:51:50 BST 2007
Olly Betts wrote:
> Yeah, that's reasonable enough. Perhaps we should profile AutoPtr vs
> RefCntPtr to see if one of them is better for such situations - I've
> wondered before.
I thought that AutoPtr wasn't appropriate for this kind of thing - as
soon as you get the pointer out of it, the AutoPtr doesn't care about
deleting it any more.
Also, this doesn't happen in this case, but if a function which we'd
passed the LeafPostList pointer to had created a new object which had a
reference to our postlist, we wouldn't want to delete the LeafPostList
at the end of our function - unreffing it is the right thing to do.
So, I say it's safest to stick to using RefCntPtr in this kind of
situation, so we don't have to think hard about whether to do so or not.
My C++ isn't really up to this level of scrutiny these days, though;
I've been doing too much Python recently!
More information about the Xapian-devel