Created on 2015-12-05.00:00:00 last changed 89 months ago
Proposed resolution:
This wording is relative to N4567.
[Drafting note: The inserted paragraph is a copy of [func.wrap.func.con]/5, only changing "copy constructor" to "copy or move constructor". It does not attempt to fix the issue identified in LWG 2370, whose P/R will likely need updating if this wording is adopted.]
Insert after [func.wrap.func.con]/6:
function(function&& f); template <class A> function(allocator_arg_t, const A& a, function&& f);-6- Effects: If !f, *this has no target; otherwise, move-constructs the target of f into the target of *this, leaving f in a valid state with an unspecified value.
-?- Throws: Shall not throw exceptions if f's target is a callable object passed via reference_wrapper or a function pointer. Otherwise, may throw bad_alloc or any exception thrown by the copy or move constructor of the stored callable object. [Note: Implementations are encouraged to avoid the use of dynamically allocated memory for small callable objects, for example, where f's target is an object holding only a pointer or reference to an object and a member function pointer. — end note]
[ 2016-02, Issues Telecon ]
P0; move to Tentatively Ready.
[func.wrap.func.con]/5 guarantees that copying a std::function whose "target is a callable object passed via reference_wrapper or a function pointer" does not throw exceptions, but the standard doesn't provide this guarantee for the move constructor, which makes scant sense.
History | |||
---|---|---|---|
Date | User | Action | Args |
2017-07-30 20:15:43 | admin | set | status: wp -> c++17 |
2016-03-07 04:11:48 | admin | set | status: ready -> wp |
2016-02-07 20:24:45 | admin | set | messages: + msg7960 |
2016-02-07 20:24:45 | admin | set | status: new -> ready |
2015-12-16 20:12:19 | admin | set | messages: + msg7652 |
2015-12-05 00:00:00 | admin | create |