1230. mem_fn and variadic templates

Section: 22.10.16 [func.memfn] Status: Dup Submitter: Alisdair Meredith Opened: 2009-10-09 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [func.memfn].

View all issues with Dup status.

Duplicate of: 920

Discussion:

Since we have removed the entry in B [implimits] for the library-specific limit for number of arguments passed to function/tuple/etc. I believe we need to update the spec for mem_fn to reflect this.

The "Remarks: Implementations may implement mem_fn as a set of overloaded function templates." no longer holds, as we cannot create an arbitrary number of such overloads. I believe we should strike the remark and add a second signature:

template<class R, class T, typename ... ArgTypes>
  unspecified mem_fn(R (T::*pm)(ArgTypes...));

I believe we need two signatures as pointer-to-data-member and pointer-to-member-function-taking-no-args appear to use subtly different syntax.

[ 920 as a similar proposed resolution. ]

Proposed resolution:

Add to 22.10 [function.objects] and 22.10.16 [func.memfn]:

template<class R, class T> unspecified mem_fn(R T::* pm)

template<class R, class T, class ...Args> unspecified mem_fn(R (T::* pm)(Args...));
template<class R, class T, class ...Args> unspecified mem_fn(R (T::* pm)(Args...) const);
template<class R, class T, class ...Args> unspecified mem_fn(R (T::* pm)(Args...) volatile);
template<class R, class T, class ...Args> unspecified mem_fn(R (T::* pm)(Args...) const volatile);

template<class R, class T, class ...Args> unspecified mem_fn(R (T::* pm)(Args...)&);
template<class R, class T, class ...Args> unspecified mem_fn(R (T::* pm)(Args...) const&);
template<class R, class T, class ...Args> unspecified mem_fn(R (T::* pm)(Args...) volatile&);
template<class R, class T, class ...Args> unspecified mem_fn(R (T::* pm)(Args...) const volatile&);

template<class R, class T, class ...Args> unspecified mem_fn(R (T::* pm)(Args...)&&);
template<class R, class T, class ...Args> unspecified mem_fn(R (T::* pm)(Args...) const&&);
template<class R, class T, class ...Args> unspecified mem_fn(R (T::* pm)(Args...) volatile&&);
template<class R, class T, class ...Args> unspecified mem_fn(R (T::* pm)(Args...) const volatile&&);

Strike 22.10.16 [func.memfn], p5:

Remarks: Implementations may implement mem_fn as a set of overloaded function templates.