Boost logo

Boost :

Subject: Re: [boost] [config] Macro for null pointer
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2012-12-04 17:21:43


On Tue, Dec 4, 2012 at 2:14 PM, Peter Dimov <lists_at_[hidden]> wrote:

> Eric Niebler wrote:
>
>> ... until some other library ALSO defines a global nullptr symbol,
>> making that library and boost mutually incompatible.
>>
>
> How is the end user supposed to actually use nullptr if it's not global?
> It's a keyword in C++11; boost::nullptr is not legal.
>

namespace X
{

BOOST_USING_NULLPTR;

void foo() { int * p = nullptr; }

} // namespace X

is the basic usage I had proposed. BOOST_USING_NULLPTR expands to some
empty statement in C++11 and "using ::boost::nullptr" in C++03.

- Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk