1072410724 void set_value_at_thread_exit(@\seebelow@ );
1072510725 void set_exception_at_thread_exit(exception_ptr p);
1072610726 };
10727-
10728- template<class R, class Alloc>
10729- struct uses_allocator<promise<R>, Alloc>;
1073010727}
1073110728\end {codeblock }
1073210729
1074610743they acquire a single mutex associated with the promise object while updating the
1074710744promise object.
1074810745
10749- \indexlibrarymember {uses_allocator}{promise}%
10750- \begin {itemdecl }
10751- template<class R, class Alloc>
10752- struct uses_allocator<promise<R>, Alloc>
10753- : true_type { };
10754- \end {itemdecl }
10755-
10756- \begin {itemdescr }
10757- \pnum
10758- \expects
10759- \tcode {Alloc} meets
10760- the \oldconcept {Allocator} requirements\iref {allocator.requirements.general }.
10761- \end {itemdescr }
10762-
1076310746\indexlibraryctor {promise}%
1076410747\begin {itemdecl }
1076510748promise();
1186111844 packaged_task() noexcept;
1186211845 template<class F>
1186311846 explicit packaged_task(F&& f);
11847+ template<class F, class Allocator>
11848+ explicit packaged_task(allocator_arg_t, const Allocator& a, F&& f);
1186411849 ~packaged_task();
1186511850
1186611851 // no copy
1191011895 explicit packaged_task(F&& f);
1191111896\end {itemdecl }
1191211897
11898+ \begin {itemdescr }
11899+ \pnum
11900+ \effects
11901+ Equivalent to:
11902+ \begin {codeblock }
11903+ packaged_task(allocator_arg, allocator<int>(), std::forward<F>(f)).
11904+ \end {codeblock }
11905+ \end {itemdescr }
11906+
11907+ \indexlibraryctor {packaged_task}%
11908+ \begin {itemdecl }
11909+ template<class F, class Allocator>
11910+ explicit packaged_task(allocator_arg_t, const Allocator& a, F&& f);
11911+ \end {itemdecl }
11912+
1191311913\begin {itemdescr }
1191411914\pnum
1191511915\constraints
@@ -11920,17 +11920,27 @@
1192011920\mandates
1192111921\tcode {is_invocable_r_v<R, decay_t<F>\& , ArgTypes...>} is \tcode {true}.
1192211922
11923+ \pnum
11924+ \expects
11925+ \tcode {Allocator} meets the \oldconcept {Allocator} requirements\iref {allocator.requirements.general }.
11926+
1192311927\pnum
1192411928\effects
11929+ Let \tcode {A2} be
11930+ \tcode {allocator_traits<Allocator>::rebind_alloc<\unspec >}
11931+ and let \tcode {a2} be an object of type \tcode {A2} initialized with
11932+ \tcode {A2(a)}.
1192511933Constructs a new \tcode {packaged_task} object with
1192611934a stored task of type \tcode {decay_t<F>} and a shared state.
1192711935Initializes the object's stored task with \tcode {std::forward<F>(f)}.
11936+ Uses \tcode {a2} to allocate storage for the shared state and stores a copy
11937+ of \tcode {a2} in the shared state.
1192811938
1192911939\pnum
1193011940\throws
11931- Any exceptions thrown by the copy or move constructor of \tcode {f}, or
11932- \tcode {bad_alloc} if memory for the internal data structures
11933- cannot be allocated .
11941+ Any exceptions thrown by the initialization of the stored task.
11942+ If storage for the shared state cannot be allocated, any exception thrown by
11943+ \tcode {A2::allocate} .
1193411944\end {itemdescr }
1193511945
1193611946\indexlibraryctor {packaged_task}%
1214012150\begin {itemdescr }
1214112151\pnum
1214212152\effects
12143- As if \tcode {*this = packaged_task(std::move(f))}, where
12153+ Equivalent to:
12154+ \begin {codeblock }
12155+ if (!valid())
12156+ throw future_error(future_errc::no_state);
12157+ *this = packaged_task(allocator_arg, a, std::move(f));
12158+ \end {codeblock }
12159+ where
1214412160\tcode {f} is the task stored in
12145- \tcode {*this}.
12161+ \tcode {*this},
12162+ and \tcode {a} is the allocator stored in the shared state.
1214612163\begin {note }
1214712164This constructs a new shared state for \tcode {*this}. The
1214812165old state is abandoned\iref {futures.state }.
1215112168\pnum
1215212169\throws
1215312170\begin {itemize }
12154- \item \tcode {bad_alloc} if memory for the new shared state cannot be allocated.
12155- \item Any exception thrown by the move constructor of the task stored in the shared
12156- state.
12171+ \item Any exception thrown by the \tcode {packaged_task} constructor.
1215712172\item \tcode {future_error} with an error condition of \tcode {no_state} if \tcode {*this}
1215812173has no shared state.
1215912174\end {itemize }
0 commit comments