Boost logo

Boost :

From: Ed Brey (brey_at_[hidden])
Date: 1999-12-28 14:09:40


> From: Greg Colvin [mailto:gcolvin_at_[hidden]]
> So define BOOST_SMART_PTR_CONVERSION and use "if(!p)",
> else use "if(!&*p)".

The latter results in undefined behavior if p is null, so if get() has got
your goat, your stuck with
BOOST_SMART_PTR_CONVERSION and "if (!p)".

Here's a safe option to avoid having to choose between using the implicit
pointer conversion and get(): define operator! and use "if (!p)" to test for
null and "if (!!p)" to test for non-null. I don't like the looks of it,
either, but that would change over time, and even better, I'd love to see how
long before people start referring to the "test for non-null operator". :-)


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