Title
mem_fn and variadic templates
Status
dup
Section
[func.memfn]
Submitter
Alisdair Meredith

Created on 2009-10-09.00:00:00 last changed 171 months ago

Messages

Date: 2011-03-05.21:44:45

Proposed resolution:

Add to [function.objects] and [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 [func.memfn], p5:

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

Date: 2010-10-21.18:28:33

[ 920 as a similar proposed resolution. ]

Date: 2009-10-09.00:00:00

Duplicate: 920

Since we have removed the entry in [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.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg1246
2010-10-21 18:28:33adminsetmessages: + msg1245
2009-10-09 00:00:00admincreate