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+ \tcode {packaged_task(allocator_arg, allocator<int>(), std::forward<F>(f))}.
11903+ \end {itemdescr }
11904+
11905+ \indexlibraryctor {packaged_task}%
11906+ \begin {itemdecl }
11907+ template<class F, class Allocator>
11908+ explicit packaged_task(allocator_arg_t, const Allocator& a, F&& f);
11909+ \end {itemdecl }
11910+
1191311911\begin {itemdescr }
1191411912\pnum
1191511913\constraints
@@ -11920,17 +11918,27 @@
1192011918\mandates
1192111919\tcode {is_invocable_r_v<R, decay_t<F>\& , ArgTypes...>} is \tcode {true}.
1192211920
11921+ \pnum
11922+ \expects
11923+ \tcode {Allocator} meets the \oldconcept {Allocator} requirements\iref {allocator.requirements.general }.
11924+
1192311925\pnum
1192411926\effects
11927+ Let \tcode {A2} be
11928+ \tcode {allocator_traits<Allocator>::rebind_alloc<\unspec >}
11929+ and let \tcode {a2} be an object of type \tcode {A2} initialized with
11930+ \tcode {A2(a)}.
1192511931Constructs a new \tcode {packaged_task} object with
1192611932a stored task of type \tcode {decay_t<F>} and a shared state.
1192711933Initializes the object's stored task with \tcode {std::forward<F>(f)}.
11934+ Uses \tcode {a2} to allocate storage for the shared state and stores a copy
11935+ of \tcode {a2} in the shared state.
1192811936
1192911937\pnum
1193011938\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 .
11939+ Any exceptions thrown by the initialization of the stored task.
11940+ If storage for the shared state cannot be allocated, any exception thrown by
11941+ \tcode {A2::allocate} .
1193411942\end {itemdescr }
1193511943
1193611944\indexlibraryctor {packaged_task}%
1214012148\begin {itemdescr }
1214112149\pnum
1214212150\effects
12143- As if \tcode {*this = packaged_task(std::move(f))}, where
12151+ Equivalent to:
12152+ \begin {codeblock }
12153+ if (!valid())
12154+ throw future_error(future_errc::no_state);
12155+ *this = packaged_task(allocator_arg, a, std::move(f));
12156+ \end {codeblock }
12157+ where
1214412158\tcode {f} is the task stored in
12145- \tcode {*this}.
12159+ \tcode {*this}
12160+ and \tcode {a} is the allocator stored in the shared state.
1214612161\begin {note }
1214712162This constructs a new shared state for \tcode {*this}. The
1214812163old state is abandoned\iref {futures.state }.
1215112166\pnum
1215212167\throws
1215312168\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.
12169+ \item Any exception thrown by the \tcode {packaged_task} constructor.
1215712170\item \tcode {future_error} with an error condition of \tcode {no_state} if \tcode {*this}
1215812171has no shared state.
1215912172\end {itemize }
0 commit comments