This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.

### 769. std::function should use nullptr_t instead of "unspecified-null-pointer-type"

Section: 20.14.17.3 [func.wrap.func] Status: CD1 Submitter: Daniel Krügler Opened: 2008-01-10 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [func.wrap.func].

View all issues with CD1 status.

Discussion:

N2461 already replaced in 20.14.17.3 [func.wrap.func] it's originally proposed (implicit) conversion operator to "unspecified-bool-type" by the new explicit bool conversion, but the inverse conversion should also use the new `std::nullptr_t` type instead of "unspecified-null-pointer- type".

Proposed resolution:

In 20.14 [function.objects], header `<functional>` synopsis replace:

>     template<class R, class... ArgTypes>
>       bool operator==(const function<R(ArgTypes...)>&, unspecified-null-pointer-type nullptr_t);
>     template<class R, class... ArgTypes>
>       bool operator==(unspecified-null-pointer-type nullptr_t , const function<R(ArgTypes...)>&);
>     template<class R, class... ArgTypes>
>       bool operator!=(const function<R(ArgTypes...)>&, unspecified-null-pointer-type nullptr_t);
>     template<class R, class... ArgTypes>
>       bool operator!=(unspecified-null-pointer-type nullptr_t , const function<R(ArgTypes...)>&);

In the class function synopsis of 20.14.17.3 [func.wrap.func] replace

>     function(unspecified-null-pointer-type nullptr_t);
>     ...
>     function& operator=(unspecified-null-pointer-type nullptr_t);

In 20.14.17.3 [func.wrap.func], "Null pointer comparisons" replace:

>     template <class R, class... ArgTypes>
>       bool operator==(const function<R(ArgTypes...)>&, unspecified-null-pointer-type nullptr_t);
>     template <class R, class... ArgTypes>
>       bool operator==(unspecified-null-pointer-type nullptr_t , const function<R(ArgTypes...)>&);
>     template <class R, class... ArgTypes>
>       bool operator!=(const function<R(ArgTypes...)>&, unspecified-null-pointer-type nullptr_t);
>     template <class R, class... ArgTypes>
>       bool operator!=(unspecified-null-pointer-type nullptr_t , const function<R(ArgTypes...)>&);

In 20.14.17.3.2 [func.wrap.func.con], replace

>     function(unspecified-null-pointer-type nullptr_t);
>     ...
>     function& operator=(unspecified-null-pointer-type nullptr_t);

In 20.14.17.3.7 [func.wrap.func.nullptr], replace

>     template <class R, class... ArgTypes>
>       bool operator==(const function<R(ArgTypes...)>& f, unspecified-null-pointer-type nullptr_t);
>     template <class R, class... ArgTypes>
>       bool operator==(unspecified-null-pointer-type nullptr_t , const function<R(ArgTypes...)>& f);

and replace

>     template <class R, class... ArgTypes>
>       bool operator!=(const function<R(ArgTypes...)>& f, unspecified-null-pointer-type nullptr_t);
>     template <class R, class... ArgTypes>
>       bool operator!=(unspecified-null-pointer-type nullptr_t , const function<R(ArgTypes...)>& f);