920. Ref-qualification support in the library

Section: 23.14.12 [func.memfn] Status: C++11 Submitter: Bronek Kozicki Opened: 2008-10-06 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [func.memfn].

View all issues with C++11 status.

Duplicate of: 1230

Discussion:

Daniel Krügler wrote:

Shouldn't above list be completed for &- and &&-qualified member functions This would cause to add:

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

yes, absolutely. Thanks for spotting this. Without this change mem_fn cannot be initialized from pointer to ref-qualified member function. I believe semantics of such function pointer is well defined.

[ Post Summit Daniel provided wording. ]

[ Batavia (2009-05): ]

We need to think about whether we really want to go down the proposed path of combinatorial explosion. Perhaps a Note would suffice.

We would really like to have an implementation before proceeding.

Move to Open, and recommend this be deferred until after the next Committee Draft has been issued.

[ 2009-10-10 Daniel updated wording to post-concepts. ]

1230 has a similar proposed resolution

[ 2009-10 Santa Cruz: ]

Move to Ready.

Proposed resolution:

  1. Change 23.14 [function.objects]/2, header <functional> synopsis as follows:

    // 20.7.14, member function adaptors:
    template<class R, class T> unspecified mem_fn(R T::*);
    
    template<class R, class T, class ...Args> unspecified mem_fn(R (T::*)(Args...));
    template<class R, class T, class ...Args> unspecified mem_fn(R (T::*)(Args...) const);
    template<class R, class T, class ...Args> unspecified mem_fn(R (T::*)(Args...) volatile);
    template<class R, class T, class ...Args> unspecified mem_fn(R (T::*)(Args...) const volatile);
    
    template<class R, class T, class ...Args> unspecified mem_fn(R (T::*)(Args...) &);
    template<class R, class T, class ...Args> unspecified mem_fn(R (T::*)(Args...) const &);
    template<class R, class T, class ...Args> unspecified mem_fn(R (T::*)(Args...) volatile &);
    template<class R, class T, class ...Args> unspecified mem_fn(R (T::*)(Args...) const volatile &);
    
    template<class R, class T, class ...Args> unspecified mem_fn(R (T::*)(Args...) &&);
    template<class R, class T, class ...Args> unspecified mem_fn(R (T::*)(Args...) const &&);
    template<class R, class T, class ...Args> unspecified mem_fn(R (T::*)(Args...) volatile &&);
    template<class R, class T, class ...Args> unspecified mem_fn(R (T::*)(Args...) const volatile &&);
    
  2. Change the prototype list of 23.14.12 [func.memfn] as follows [NB: The following text, most notably p.2 and p.3 which discuss influence of the cv-qualification on the definition of the base class's first template parameter remains unchanged. ]:

    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 &&);
    
  3. Remove 23.14.12 [func.memfn]/5:

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