Title
packaged_task::result_type should be removed
Status
c++11
Section
[futures.task]
Submitter
Anthony Williams

Created on 2010-11-12.00:00:00 last changed 154 months ago

Messages

Date: 2011-02-24.20:02:43

Proposed resolution:

Alter the class definition of packaged_task in [futures.task] p. 2 as follows:

template<class R, class... ArgTypes>
class packaged_task<R(ArgTypes...)> {
public:
  typedef R result_type;
  [...]
};
Date: 2011-02-24.00:00:00

[ 2011-02-24 Reflector discussion ]

Moved to Tentatively Ready after 5 votes.

Date: 2010-11-12.00:00:00

packaged_task::operator() always returns void, regardless of the return type of the wrapped task. However, packaged_task::result_type is a typedef to the return type of the wrapped task. This is inconsistent with other uses of result_type in the standard, where it matches the return type of operator() (e.g. function, owner_less). This is confusing.

It also violates the TR1 result_of protocol, and thus makes packaged_task harder to use with anything that respects that protocol.

Finally, it is of little use anyway.

packaged_task::result_type should therefore be removed.

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-24 20:02:43adminsetmessages: + msg5540
2011-02-24 20:02:43adminsetstatus: new -> ready
2011-02-21 17:46:04adminsetmessages: + msg5525
2010-11-12 00:00:00admincreate