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

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

Priority: Not Prioritized

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

View all issues with CD1 status.

Discussion:

N2461 already replaced in 23.14.13.2 [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 23.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 23.14.13.2 [func.wrap.func] replace

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

In 23.14.13.2 [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 23.14.13.2.1 [func.wrap.func.con], replace

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

In 23.14.13.2.6 [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);