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


What do the boosters think of adding a definition of null to
utility.hpp (inspired by a recent post to comp.std.c++), like this:

namespace boost {

#if !defined(BOOST_NO_CONVERSION_MEMBER_TEMPLATES)
        const struct null_t {
                null_t() {}
                template<typename T> operator T*() const {return 0;}
        } null;
#else
        const int null = 0;
#endif

}

The idea is that anyone who wants to have a null "keyword" (not
really, but close, and maybe better), adds a "using boost::null;" to
some common header file.

As usual, a certain misprioritized compiler prompted me to include a
less safe, worked-around version for the moment.

Also as usual, suggestions for better names for the macro are
appreciated.

Finally, a question: If I don't include the constructor in null_t,
egcs-2.91.57 complains of an uninitialized constant. Is this right?
Even though null_t is a POD, since it has no members, no
initialization should be required. I don't know where to look in the
IS to find out if initialization is required anyway, presumably just
for orthagonality.