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.
packaged_task::operator bool()Section: 32.10.10 [futures.task] Status: Resolved Submitter: INCITS Opened: 2010-08-25 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [futures.task].
View all issues with Resolved status.
Discussion:
Addresses US-201
packaged_task provides operator bool() to check whether
an object has an associated asynchronous state. The various future
types provide a member function valid() that does the same thing.
The names of these members should be the same.
[ Resolution proposed by ballot comment: ]
Replaced the name
packaged_task::operator bool()withpackaged_task::valid()in the synopsis (32.10.10 [futures.task]/2) and the member function specification (before 32.10.10.2 [futures.task.members]/15).
[
2010-11-02 Daniel translates proposed wording changes into a proper proposed resolution
and verified that no other places implicitly take advantage of packaged_task
conversion to bool.
]
[Resolved in Batavia by accepting n3194. ]
Proposed resolution:
packaged_task synopsis as indicated:
template<class R, class... ArgTypes>
class packaged_task<R(ArgTypes...)> {
public:
typedef R result_type;
[..]
explicit operator bool valid() const;
[..]
};
explicit operatorbool valid() const;15 Returns: true only if
16 Throws: nothing.*thishas an associated asynchronous state.