From: Jason Hise (chaos_at_[hidden])
Date: 2005-01-21 00:40:33


Just wondering if there was any interest in a better null, or if such a
thing existed in boost already. The code is relatively simple:

class null
{
public:
    explicit null ( void * )
    {
    }

    ~ null ( )
    {
    }

    template < typename T >
    operator T * ( )
    {
        return 0;
    }
};

null null ( 0 );

Example usage:

int * p = null; // ok
int i = null; // error: null cannot be converted to an int

-Jason