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.

816. Should 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 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 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 (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.

[ 2009-07 Frankfurt: ]

Related to 817 (see below). Leave Open.

[ 2009-10 Santa Cruz: ]

Move to Ready. Decoupling from issue 817.

[ 2010-02-11 Moved from Ready to Tentatively NAD Editorial, rationale added below. ]

Rationale:

This issue is solved as proposed by 817.

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 of g(u1, u2, ..., uM) shall be INVOKE(f, v1, v2, ..., vN, Callable<F cv,V1, V2, ..., VN>::result_type), where cv represents the cv-qualifiers of g and the values and types of the bound arguments v1, 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 of F or any of the types in BoundArgs... throw an exception.

...

-5- Returns: A forwarding call wrapper g with a nested type result_type defined as a synonym for R. The effect of g(u1, u2, ..., uM) shall be INVOKE(f, v1, v2, ..., vN, R), where the values and types of the bound arguments v1, 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 of F or any of the types in BoundArgs... throw an exception.