Re: [boost] Re: Re: [review] Formal review of

In-Reply-To: <ck8s5t$p2p$1@sea.gmane.org> nesotto@cs.auc.dk (Thorsten Ottosen) wrote (abridged):
could you post your real code along with reasons for putting a null into the tree and maybe some comments about the density of null's in the tree.
There is no reason to put a null in the tree. The density of nulls in the tree should be zero. The code needs to be surrounded by a test, equivalent to: if (pDog != 0) { pDog->walk_to( pTree ); assert( pDog->location() == pTree ); // ... more code assuming the dog's location. } My point is that using null_object does not enable you to avoid the "if" statement. And further, having a walk_to() member which is valid for some Dog subclasses and not others, is not really an improvement. -- Dave Harris, Nottingham, UK

Dave Harris <brangdon <at> cix.compulink.co.uk> writes:
There is no reason to put a null in the tree. The density of nulls in the tree should be zero.
The code needs to be surrounded by a test, equivalent
to:
if (pDog != 0) { pDog->walk_to( pTree ); assert( pDog->location() == pTree ); // ... more code assuming the dog's location. }
My point is that using null_object does not enable you to avoid the "if" statement. And further, having a walk_to() member which is valid for some Dog subclasses and not others, is not really an improvement.
I suspect having null is reasonable, but I explicitly requested to see the code. Otherwise its hard to make a real jugdement. If there is no null in the tree, then why test for it? br Thorsten, the confused
participants (2)
-
brangdon@cix.compulink.co.uk
-
Thorsten Ottosen