This is what I came up with, given your code:

static struct nullptr_t
{
    template< typename t_type >
    operator t_type* () { return 0; }
} nullptr;

One difference is that I made the nullptr object static so it could be placed in a header without linker conflicts. Your idea is great and simple, I like it. Thanks a lot.

On Jan 2, 2008 4:06 PM, Kobi Cohen-Arazi <kobi.cohenarazi@gmail.com> wrote:
>
> Does boost have some sort of null_ptr class that allows you to do portable
> NULL comparisons?

Would that works for you:

struct nullptr_t
{
  template<class T> operator T* () const { return 0; }
}nullptr;


?
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users