On 30 January 2014 01:12, Ben Pope <benpope81@gmail.com> wrote:

Then, removing the #if !defined( BOOST_NO_CXX11_NULLPTR ) guard from the constructor of shared_ptr that accepts a boost::detail::sp_nullptr_t does indeed seem to work.

namespace boost {
   namespace detail {
      struct sp_nullptr_t {};
   }
   const detail::sp_nullptr_t nullptr = detail::sp_nullptr_t();
}

#include <boost/smart_ptr/shared_ptr.hpp>

int f(boost::shared_ptr<int> i) { return i ? *i : 0; }

int main()
{
   f(boost::nullptr);
}

...there's probably some reason I'm not thinking of.

You can read the paper behind std::nullptr at <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf>.  The short answer is (a) boost::sp_nullptr_t isn't convertible to any pointer or pointer-to-member type, and (b) you really don't want to use boost::nullptr, given that nullptr is a keyword in C++11.
--
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404