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

### 1230. `mem_fn` and variadic templates

Section: 20.14.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 20.14 [function.objects] and 20.14.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 20.14.16 [func.memfn], p5:

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