This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.

### 2921. `packaged_task` and type-erased allocators

Section: 32.9.10 [futures.task] Status: C++17 Submitter: United States Opened: 2017-02-03 Last modified: 2020-09-06

Priority: Not Prioritized

View all other issues in [futures.task].

View all issues with C++17 status.

Discussion:

Addresses US 165

The constructor that type-erases an allocator has all of the problems of the similar function constructor that was removed for this CD. This constructor from `packaged_task` should similarly be removed as well. If we prefer to keep this constructor, the current wording is underspecified, as the `Allocator` argument is not required to be type satisfying the Allocator requirements, nor is `allocator_traits` used.

Proposed change:

Strike

>     template <class F, class Allocator>
>     packaged_task(allocator_arg_t, const Allocator& a, F&& f);

from the class definition in p2, and from 30.6.9.1 [futures.task.members] p2. Strike the last sentence of 30.6.9.1p4. In p3, revise "These constructors" to "This constructor"

[Kona 2017-03-02]

Accepted as Immediate to resolve NB comment.

Proposed resolution:

This wording is relative to N4618.

1. Modify 32.9.10 [futures.task] as follows:

   Strike

   >     template <class F, class Allocator>
   >     packaged_task(allocator_arg_t, const Allocator& a, F&& f);

   from the class definition in p2, and from [futures.task.members] p2.

2. Modify 32.9.10.2 [futures.task.members]/3:

   > Remarks: These constructors This constructor shall not participate in overload resolution if `decay_t<F>` is the same type as `packaged_task<R(ArgTypes...)>`.

3. Strike the last sentence of 32.9.10.2 [futures.task.members]/4:

   > The constructors that take an `Allocator` argument use it to allocate memory needed to store the internal data structures.