This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.
bind()
's returned functor have a nofail copy ctor when bind()
is nofail?Section: 22.10.15.4 [func.bind.bind] Status: Resolved Submitter: Stephan T. Lavavej Opened: 2008-02-08 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [func.bind.bind].
View all issues with Resolved status.
Discussion:
Library Issue 527(i) notes that bind(f, t1, ..., tN)
should be nofail when f, t1, ..., tN
have nofail copy ctors.
However, no guarantees are provided for the copy ctor of the functor
returned by bind()
. (It's guaranteed to have a copy ctor, which can
throw implementation-defined exceptions: bind()
returns a forwarding
call wrapper, TR1 3.6.3/2. A forwarding call wrapper is a call wrapper,
TR1 3.3/4. Every call wrapper shall be CopyConstructible, TR1 3.3/4.
Everything without an exception-specification may throw
implementation-defined exceptions unless otherwise specified, C++03
17.4.4.8/3.)
Should the nofail guarantee requested by Library Issue 527(i) be extended
to cover both calling bind()
and copying the returned functor?
[ Howard adds: ]
tuple
construction should probably have a similar guarantee.
[ San Francisco: ]
Howard to provide wording.
[ Post Summit, Anthony provided wording. ]
[ Batavia (2009-05): ]
Part of all of this issue appears to be rendered moot by the proposed resolution to issue 817(i) (q.v.). We recommend the issues be considered simultaneously (or possibly even merged) to ensure there is no overlap. Move to Open, and likewise for issue 817(i).
[ 2009-07 Frankfurt: ]
[ 2009-10 Santa Cruz: ]
[ 2010-02-11 Moved from Ready to Tentatively NAD Editorial, rationale added below. ]
Rationale:
This issue is solved as proposed by 817(i).
Proposed resolution:
Add a new sentence to the end of paragraphs 2 and 4 of 22.10.15.4 [func.bind.bind]:
-2- Returns: A forwarding call wrapper
g
with a weak result type (20.6.2). The effect ofg(u1, u2, ..., uM)
shall beINVOKE(f, v1, v2, ..., vN, Callable<F cv,V1, V2, ..., VN>::result_type)
, where cv represents the cv-qualifiers ofg
and the values and types of the bound argumentsv1, v2, ..., vN
are determined as specified below. The copy constructor and move constructor of the forwarding call wrapper shall throw an exception if and only if the corresponding constructor ofF
or any of the types inBoundArgs...
throw an exception....
-5- Returns: A forwarding call wrapper
g
with a nested typeresult_type
defined as a synonym forR
. The effect ofg(u1, u2, ..., uM)
shall beINVOKE(f, v1, v2, ..., vN, R)
, where the values and types of the bound argumentsv1, v2, ..., vN
are determined as specified below. The copy constructor and move constructor of the forwarding call wrapper shall throw an exception if and only if the corresponding constructor ofF
or any of the types inBoundArgs...
throw an exception.