From: Dave Abrahams (abrahams_at_[hidden])
Date: 2000-01-03 08:07:18


> 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.
>

How about a free function in boost:: which was also specialized for
std::auto_ptr and for raw pointers? That would allow some generic
programming which would otherwise be impossible.