Date: 2000-01-29 09:33:05
"stephen c. gilardi" <squeege-_at_[hidden]> wrote:
> > > if (left == this)
> > > delete ptr;
> I could be wrong, but I don't think this is a correct test for
You are right, but the test (left == right) could safely be used in
I took the night off. You all have very good suggestions. I am happy
there seems to be considerable interest in the idea.
I don't want to take too much time here, but I did want to quickly
address a couple of points that have come up since yesterday.
Re: checking ptr before delete called -- in the case where ptr is null,
checking "if (ptr)" will avoid a function call to delete. I thought it
would be worth the cost overall. Side note: what proportion of non-null
to null pointers would need to be released before the "if (ptr)"
becomes less efficient? I suspect it is > 1000:1.
Re: "this" vs. "0" -- I don't have strong feelings either way. It
seems that using circular linking results in an extremely small gain in
efficiency. So small that *if* the approach requires a longer learning
curve, it is not worthwhile. I would defer to popular opinion, and
tend toward whichever approach is considered more readable/maintainable
. I am biased toward my original "0" approach, but I still do admire
the elegance of the "this" approach.
Re: the timing tests -- I will get to this on Monday.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk