Title
<future> still has type-erased allocators in promise
Status
open
Section
[futures.promise]
Submitter
Billy O'Neal III

Created on 2017-07-16.00:00:00 last changed 59 months ago

Messages

Date: 2019-06-03.09:53:27

Proposed resolution:

This resolution is relative to N4659.

  1. Edit [futures.promise], class template promise synopsis, as indicated:

    template<class R> 
    class promise {
    public:
      promise();
      template <class Allocator>
        promise(allocator_arg_t, const Allocator& a);
      […]
    };
    template <class R>
      void swap(promise<R>& x, promise<R>& y) noexcept;
    template <class R, class Alloc>
      struct uses_allocator<promise<R>, Alloc>;
    
    […]
    template <class R, class Alloc>
      struct uses_allocator<promise<R>, Alloc>
        : true_type { };
    

    -3- Requires: Alloc shall be an Allocator ([allocator.requirements]).

    promise();
    template <class Allocator>
      promise(allocator_arg_t, const Allocator& a);
    

    -4- Effects: constructs a promise object and a shared state. The second constructor uses the allocator a to allocate memory for the shared state.

Date: 2019-06-03.00:00:00

[ 2019-06-03 ]

Jonathan observes that this resolution conflicts with 2095.

Date: 2018-01-26.00:00:00

[ 2018-1-26 issues processing telecon ]

Status to 'Open'; Billy to write a paper.

Date: 2017-11-29.03:09:11

[ 28-Nov-2017 Mailing list discussion - set priority to P2 ]

Lots of people on the ML feel strongly about this; the suggestion was made that a paper would be welcomed laying out the rationale for removing allocator support here (and in other places).

Date: 2017-07-16.00:00:00

In Toronto Saturday afternoon LWG discussed LWG 2976 which finishes the job of removing allocator support from packaged_task. LWG confirmed that, despite the removal of packaged_task allocators "because it looks like std::function" was incorrect, they wanted to keep the allocator removals anyway, in large part due to this resolution being a response to an NB comment.

If we don't want the type erased allocator situation at all, then we should remove them from the remaining place they exist in <future>, namely, in promise.

This change also resolves potential implementation divergence on whether allocator::construct is intended to be used on elements constructed in the shared state, and allows the emplace-construction-in-future paper, P0319, to be implemented without potential problems there.

History
Date User Action Args
2019-06-03 09:53:27adminsetmessages: + msg10413
2018-01-28 19:43:07adminsetmessages: + msg9656
2018-01-28 19:43:07adminsetstatus: new -> open
2017-11-29 03:09:11adminsetmessages: + msg9570
2017-07-16 14:02:00adminsetmessages: + msg9412
2017-07-16 00:00:00admincreate