Title
Difference between callable wrapper and forwarding call wrapper unclear
Status
c++11
Section
[func.require]
Submitter
Jens Maurer

Created on 2009-12-21.00:00:00 last changed 154 months ago

Messages

Date: 2010-11-23.13:22:14

Proposed resolution:

Change [func.require]/4 as indicated:

[..] A forwarding call wrapper is a call wrapper that can be called with an arbitrary argument list and delivers the arguments as references to the wrapped callable object. This forwarding step shall ensure that rvalue arguments are delivered as rvalue-references and lvalue arguments are delivered as lvalue-references. [Note: in a typical implementation forwarding call wrappers have an overloaded function call operator of the form

template<class... UnBoundArgs>
R operator()(UnBoundArgs&&... unbound_args) cv-qual;

end note ]

Date: 2010-11-23.13:22:14

[ Adopted at 2010-11 Batavia ]

Date: 2010-09-14.00:00:00

[ 2010-09-14 Daniel provides improved wording and verified that it is correct against N3126. Previous resolution is shown here: ]

4 [..] A forwarding call wrapper is a call wrapper that can be called with an arbitrary argument list and uses perfect forwarding to deliver the arguments to the wrapped callable object. [Note: in a typical implementation forwarding call wrappers have an overloaded function call operator of the form

template<class... ArgTypes>
R operator()(ArgTypes&&... args) cv-qual;

end note]

Date: 2009-12-21.00:00:00

The current wording in the standard makes it hard to discriminate the difference between a "call wrapper" as defined in [func.def]/5+6:

5 A call wrapper type is a type that holds a callable object and supports a call operation that forwards to that object.

6 A call wrapper is an object of a call wrapper type.

and a "forwarding call wrapper" as defined in [func.require]/4:

4 [..] A forwarding call wrapper is a call wrapper that can be called with an argument list. [Note: in a typical implementation forwarding call wrappers have an overloaded function call operator of the form

template<class... ArgTypes>
R operator()(ArgTypes&&... args) cv-qual;

end note]

Reason for this lack of clear difference seems to be that the wording adaption to variadics and rvalues that were applied after it's original proposal in N1673:

[..] A forwarding call wrapper is a call wrapper that can be called with an argument list t1, t2, ..., tN where each ti is an lvalue. The effect of calling a forwarding call wrapper with one or more arguments that are rvalues is implementation defined. [Note: in a typical implementation forwarding call wrappers have overloaded function call operators of the form

template<class T1, class T2, ..., class TN>
R operator()(T1& t1, T2& t2, ..., TN& tN) cv-qual;

end note]

combined with the fact that the word "forward" has two different meanings in this context. This issue attempts to clarify the difference better.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-11-23 13:22:14adminsetmessages: + msg5401
2010-11-14 13:10:57adminsetstatus: voting -> wp
2010-11-13 01:17:02adminsetstatus: open -> voting
2010-11-13 01:11:40adminsetstatus: immediate -> open
2010-11-08 23:37:02adminsetstatus: new -> immediate
2010-10-24 22:04:47adminsetmessages: + msg5050
2010-10-21 18:28:33adminsetmessages: + msg1483
2009-12-21 00:00:00admincreate