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.

### 1508. Rename `packaged_task::operator bool()`

Section: 33.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()` with `packaged_task::valid()` in the synopsis (33.10.10 [futures.task]/2) and the member function specification (before 33.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:

1. Change 33.10.10 [futures.task]/2, class template `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;
   >       [..]
   >     };

2. Change 33.10.10 [futures.task] before p. 15 as indicated:

   >     explicit operator bool valid() const;

   > > 15 Returns: true only if `*this` has an associated asynchronous state.

   > > 16 Throws: nothing.