Boost logo

Boost Users :

From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-01-02 17:13:22


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_at_[hidden]> 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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net