Boost logo

Boost :

From: Beman Dawes (beman_at_[hidden])
Date: 1999-12-31 16:03:57


At 01:09 PM 12/28/99 -0600, Ed Brey wrote:

>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". :-)

This thread ran on so long I can't remember if anyone suggested
adding an is_null() member. Seems like that would be clearer than
adding an operator! member. I can't see asking people to write "if
(!!p)" to test for non-null. "if (!p.is_null())" is not quite as
likely to be misread or miswritten.

--Beman


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