Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-06-16 14:40:35

Marc Horowitz:

>I am attempting to use Boost.Bind to create a callable where some of
> the bound arguments might be NULL. Here is a simple example:
> void f(const char *) {}
> int main()
> {
> (std::tr1::bind(f, _1))(NULL);
> return(0);
> }

This is indeed annoying. I've also been using

> class NullPlaceholder
> {
> public:
> template <class T>
> operator T*() const { return((T*)NULL); }
> };
> NullPlaceholder _NULL;

except not calling it _NULL since this name is reserved.

We should probably have boost/nullptr.hpp that defines the macro nullptr to
something like (::boost::nullptr_t()) in C++03 mode and does nothing
otherwise (as C++0x will have a nullptr keyword.)

shared_ptr will also need a nullptr_t type when it's updated to match the
C++0x interface.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at