Title
Ref-qualification support in the library
Status
c++11
Section
[func.memfn]
Submitter
Bronek Kozicki

Created on 2008-10-06.00:00:00 last changed 161 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

  1. Change [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 [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 [func.memfn]/5:

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

Date: 2010-10-21.18:28:33

[ 2009-10 Santa Cruz: ]

Move to Ready.

Date: 2009-10-10.00:00:00

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

1230 has a similar proposed resolution

Date: 2010-10-21.18:28:33

[ 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.

Date: 2010-10-21.18:28:33

[ Post Summit Daniel provided wording. ]

Date: 2008-10-06.00:00:00

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.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-10-21 18:28:33adminsetmessages: + msg4374
2010-10-21 18:28:33adminsetmessages: + msg4373
2010-10-21 18:28:33adminsetmessages: + msg4372
2010-10-21 18:28:33adminsetmessages: + msg4371
2010-10-21 18:28:33adminsetmessages: + msg4370
2008-10-06 00:00:00admincreate