Created on 2018-06-08.00:00:00 last changed 12 months ago
Proposed resolution:
This wording is relative to N4849.
Modify [futures.task], class template packaged_task synopsis, as indicated:
namespace std { […] template<class R, class... ArgTypes> class packaged_task<R(ArgTypes...)> { […] }; template<class R, class... ArgTypes> packaged_task(R (*)(ArgTypes...)) -> packaged_task<R(ArgTypes...)>; template<class F> packaged_task(F) -> packaged_task<see below>; template<class R, class... ArgTypes> void swap(packaged_task<R(ArgTypes...)>& x, packaged_task<R(ArgTypes...)>& y) noexcept; }
Modify [futures.task.members] as indicated:
template<class F> packaged_task(F&& f);[…]template<class F> packaged_task(F) -> packaged_task<see below>;[…]-?- Constraints: &F::operator() is well-formed when treated as an unevaluated operand and decltype(&F::operator()) is of the form R(G::*)(A...) cv &opt noexceptopt for a class type G.
-?- Remarks: The deduced type is packaged_task<R(A...)>.packaged_task(packaged_task&& rhs) noexcept;
[ 2020-11-09 Approved In November virtual meeting. Status changed: Ready → WP. ]
[ Status to Ready on Friday in Prague. ]
[ 2020-02-14; Prague ]
Do we want a feature test macro for this new feature?
F N A 1 7 6
[ 2020-02-13; Prague ]
LWG improves wording matching Marshall's Mandating paper.
[ 2018-06-23 after reflector discussion ]
Priority set to 3
Previous resolution [SUPERSEDED]:
This wording is relative to N4750.
Modify [futures.task], class template packaged_task synopsis, as indicated:
namespace std { […] template<class R, class... ArgTypes> class packaged_task<R(ArgTypes...)> { […] }; template<class R, class... ArgTypes> packaged_task(R (*)( ArgTypes ...)) -> packaged_task<R( ArgTypes...)>; template<class F> packaged_task(F) -> packaged_task<see below>; template<class R, class... ArgTypes> void swap(packaged_task<R(ArgTypes...)>& x, packaged_task<R(ArgTypes...)>& y) noexcept; }Modify [futures.task.members] as indicated:
template<class F> packaged_task(F&& f);[…]template<class F> packaged_task(F) -> packaged_task<see below>;[…]-?- Remarks: This deduction guide participates in overload resolution only if &F::operator() is well-formed when treated as an unevaluated operand. In that case, if decltype(&F::operator()) is of the form R(G::*)(A...) cv &opt noexceptopt for a class type G, then the deduced type is packaged_task<R(A...)>.
packaged_task(packaged_task&& rhs) noexcept;
std::function has deduction guides, but std::packaged_task, which is otherwise very similar, does not. This is surprising to users and I can think of no reason for the former to be treated differently from the latter. I therefore propose to add deduction guides for packaged task with the same semantics as the existing ones for function.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-11-22 15:47:43 | admin | set | status: wp -> c++23 |
2020-11-09 20:31:48 | admin | set | messages: + msg11540 |
2020-11-09 20:31:48 | admin | set | status: ready -> wp |
2020-02-14 15:01:42 | admin | set | status: new -> ready |
2020-02-14 15:01:42 | admin | set | messages: + msg11124 |
2020-02-14 15:01:42 | admin | set | status: new -> new |
2020-02-14 13:26:26 | admin | set | messages: + msg11122 |
2020-02-14 08:01:28 | admin | set | status: ready -> new |
2020-02-13 21:47:47 | admin | set | messages: + msg11087 |
2018-06-25 00:47:25 | admin | set | messages: + msg9983 |
2018-06-16 15:02:29 | admin | set | messages: + msg9916 |
2018-06-08 00:00:00 | admin | create |