Boost logo

Boost :

From: Dave Harris (brangdon_at_[hidden])
Date: 2004-10-11 06:33:56


In-Reply-To: <ck8s5t$p2p$1_at_[hidden]>
nesotto_at_[hidden] (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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk