Title
Initialization of the stored task of a packaged_task
Status
c++11
Section
[futures.task.members]
Submitter
Alberto Ganesh Barbati

Created on 2011-02-09.00:00:00 last changed 153 months ago

Messages

Date: 2011-02-26.19:50:01

Proposed resolution:

(wording written assuming LWG 1514 is also accepted)

  1. Change [futures.task.members] paragraph 3:

    3 Effects: constructs a new packaged_task object with an associated asynchronous state and stores a copy of f as the object's stored taskinitializes the object's stored task with std::forward<F>(f). The constructors that take an Allocator argument use it to allocate memory needed to store the internal data structures.

  2. Change [futures.task.members] paragraph 5:

    5 Effects: constructs a new packaged_task object and transfers ownership of other's associated asynchronous state to *this, leaving other with no associated asynchronous state. Moves the stored task from other to *this.

Date: 2011-02-26.00:00:00

[ 2011-02-26 Reflector discussion ]

Moved to Tentatively Ready after 5 votes.

Date: 2011-02-25.00:00:00

[ 2011-02-25: Alberto updates wording ]

Date: 2011-02-09.00:00:00

Related with LWG issue 1514.

The move constructor of packaged_task does not specify how the stored task is constructed. The obvious way is to move-construct it using the task stored in the argument. Moreover, the constructor should be provided with a throws clause similar to one used for the other constructors, as the move constructor of the stored task is not required to be nothrow.

As for the other constructors, the terms "stores a copy of f" do not reflect the intent, which is to allow f to be moved when possible.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2011-04-11 11:23:23adminsetstatus: voting -> wp
2011-03-05 15:24:28adminsetstatus: ready -> voting
2011-02-26 19:50:01adminsetmessages: + msg5557
2011-02-26 19:50:01adminsetstatus: new -> ready
2011-02-25 15:42:20adminsetmessages: + msg5545
2011-02-11 18:49:33adminsetmessages: + msg5483
2011-02-09 00:00:00admincreate