diff --git a/source/algorithms.tex b/source/algorithms.tex index c6ea2cd6b7..21eef2be97 100644 --- a/source/algorithms.tex +++ b/source/algorithms.tex @@ -10425,8 +10425,7 @@ and \tcode{proj1} and \tcode{proj2} be \tcode{identity\{\}} for the overloads with no parameters by those names; \item - $M$ be \tcode{last1 - first1} plus the number of elements in \range{first2}{last2} - that are not present in \range{first1}{last1}; + $M$ be the number of elements in the sorted union (see below); \item \tcode{result_last} be \tcode{result + $M$} for the overloads with no parameter \tcode{result_last} or \tcode{result_r}; @@ -10442,8 +10441,21 @@ \pnum \effects -Constructs a sorted union of $N$ elements from the two ranges; +Constructs a sorted union of the elements from the two ranges; that is, the set of elements that are present in one or both of the ranges. +If \range{first1}{last1} contains $m$ elements +that are equivalent to each other and +\range{first2}{last2} contains $n$ elements that are equivalent to them, +then all $m$ elements from the first range +are included in the union, in order, and +then the final $\max(n - m,0)$ elements from the second range +are included in the union, in order. +If, of those elements, $k$ elements from the first range +are copied to the output range, +then the first $\min(k,n)$ elements from the second range +are considered \term{skipped}. +Copies the first $N$ elements of the sorted union +to the range \range{result}{result + $N$}. \pnum \returns @@ -10456,10 +10468,9 @@ for the overloads in namespace \tcode{ranges}, if $N$ is equal to $M$. \item - Otherwise, \tcode{\{j1, j2, result_last\}} + Otherwise, \tcode{\{first1 + $A$, first2 + $B$, result_last\}} for the overloads in namespace \tcode{ranges}, - where the iterators \tcode{j1} and \tcode{j2} - point to positions past the last copied or skipped elements + where $A$ and $B$ are the numbers of copied or skipped elements in \range{first1}{last1} and \range{first2}{last2}, respectively. \end{itemize} @@ -10471,14 +10482,6 @@ \pnum \remarks Stable\iref{algorithm.stable}. -If \range{first1}{last1} contains $m$ elements -that are equivalent to each other and -\range{first2}{last2} contains $n$ elements -that are equivalent to them, -then all $m$ elements from the first range -are copied to the output range, in order, and -then the final $\max(n - m, 0)$ elements from the second range -are copied to the output range, in order. \end{itemdescr} \rSec3[set.intersection]{\tcode{set_intersection}} @@ -10555,8 +10558,7 @@ and \tcode{proj1} and \tcode{proj2} be \tcode{identity\{\}} for the overloads with no parameters by those names; \item - $M$ be the number of elements in \range{first1}{last1} - that are present in \range{first2}{last2}; + $M$ be the number of elements in the sorted intersection (see below); \item \tcode{result_last} be \tcode{result + $M$} for the overloads with no parameter \tcode{result_last} or \tcode{result_r}; @@ -10572,8 +10574,23 @@ \pnum \effects -Constructs a sorted intersection of $N$ elements from the two ranges; +Constructs a sorted intersection of the elements from the two ranges; that is, the set of elements that are present in both of the ranges. +If \range{first1}{last1} contains $m$ elements +that are equivalent to each other and +\range{first2}{last2} contains $n$ elements +that are equivalent to them, +the first $\min(m, n)$ elements +are included in the sorted intersection. +If, of those elements, $k$ elements from the first range +are copied to the output range, +then the first $k$ elements from the second range +are considered \term{skipped}. +If $N < M$, a non-copied element is also considered skipped +if it compares less than the $(N+1)^\text{th}$ element +of the sorted intersection. +Copies the first $N$ elements of the sorted intersection +to the range \range{result}{result + $N$}. \pnum \returns @@ -10586,10 +10603,9 @@ for the overloads in namespace \tcode{ranges}, if $N$ is equal to $M$. \item - Otherwise, \tcode{\{j1, j2, result_last\}} + Otherwise, \tcode{\{first1 + $A$, first2 + $B$, result_last\}} for the overloads in namespace \tcode{ranges}, - where the iterators \tcode{j1} and \tcode{j2} - point to positions past the last copied or skipped elements + where $A$ and $B$ are the numbers of copied or skipped elements in \range{first1}{last1} and \range{first2}{last2}, respectively. \end{itemize} @@ -10601,12 +10617,6 @@ \pnum \remarks Stable\iref{algorithm.stable}. -If \range{first1}{last1} contains $m$ elements -that are equivalent to each other and -\range{first2}{last2} contains $n$ elements -that are equivalent to them, -the first $\min(m, n)$ elements -are copied from the first range to the output range, in order. \end{itemdescr} \rSec3[set.difference]{\tcode{set_difference}} @@ -10682,8 +10692,7 @@ and \tcode{proj1} and \tcode{proj2} be \tcode{identity\{\}} for the overloads with no parameters by those names; \item - $M$ be the number of elements in \range{first1}{last1} - that are not present in \range{first2}{last2}; + $M$ be the number of elements in the sorted difference (see below); \item \tcode{result_last} be \tcode{result + $M$} for the overloads with no parameter \tcode{result_last} or \tcode{result_r}; @@ -10699,10 +10708,17 @@ \pnum \effects -Copies $N$ elements of the range \range{first1}{last1} -which are not present in the range \range{first2}{last2} +Constructs a sorted difference between the elements from the two ranges; +that is, the set of elements that are present +in the range \range{first1}{last1} but not \range{first2}{last2}. +If \range{first1}{last1} contains $m$ elements +that are equivalent to each other and +\range{first2}{last2} contains $n$ elements +that are equivalent to them, +the last $\max(m - n, 0)$ elements from \range{first1}{last1} +are included in the sorted difference, in order. +Copies the first $N$ elements of the sorted difference to the range \range{result}{result + $N$}. -The elements in the constructed range are sorted. \pnum \returns @@ -10718,8 +10734,8 @@ Otherwise, \tcode{\{j1, result_last\}} for the overloads in namespace \tcode{ranges}, where the iterator \tcode{j1} - points to the position past the last copied or skipped element - in \range{first1}{last1}. + points to the position of the element in \range{first1}{last1} + corresponding to the $(N+1)^\text{th}$ element of the sorted difference. \end{itemize} \pnum @@ -10729,12 +10745,7 @@ \pnum \remarks -If \range{first1}{last1} contains $m$ elements -that are equivalent to each other and -\range{first2}{last2} contains $n$ elements -that are equivalent to them, -the last $\max(m - n, 0)$ elements from \range{first1}{last1} -are copied to the output range, in order. +Stable\iref{algorithm.stable}. \end{itemdescr} \rSec3[set.symmetric.difference]{\tcode{set_symmetric_difference}} @@ -10813,14 +10824,12 @@ and \tcode{proj1} and \tcode{proj2} be \tcode{identity\{\}} for the overloads with no parameters by those names; \item - $K$ be the number of elements in \range{first1}{last1} that are not present in \range{first2}{last2}. -\item - $M$ be the number of elements in \range{first2}{last2} that are not present in \range{first1}{last1}. + $M$ be the number of elements in the sorted symmetric difference (see below); \item - \tcode{result_last} be \tcode{result + $M$ + $K$} + \tcode{result_last} be \tcode{result + $M$} for the overloads with no parameter \tcode{result_last} or \tcode{result_r}; \item - $N$ be $\min(K + M, \ \tcode{result_last - result})$. + $N$ be $\min(M, \ \tcode{result_last - result})$. \end{itemize} \pnum @@ -10831,12 +10840,24 @@ \pnum \effects -Copies the elements of the range \range{first1}{last1} -that are not present in the range \range{first2}{last2}, -and the elements of the range \range{first2}{last2} -that are not present in the range \range{first1}{last1} +Constructs a sorted symmetric difference of the elements from the two ranges; +that is, the set of elements that are present +in exactly one of \range{first1}{last1} and \range{first2}\range{last2}. +If \range{first1}{last1} contains $m$ elements +that are equivalent to each other and +\range{first2}{last2} contains $n$ elements +that are equivalent to them, +then $|m - n|$ of those elements are included in the symmetric difference: +the last $m - n$ of these elements from \range{first1}{last1}, +in order, if $m > n$, and +the last $n - m$ of these elements from \range{first2}{last2}, +in order, if $m < n$. +If $N < M$, a non-copied element is considered \term{skipped} +if it compares less than or equivalent to the $(N+1)^\text{th}$ element +of the sorted symmetric difference, +unless it is from the same range as that element and does not precede it. +Copies the first $N$ elements of the sorted symmetric difference to the range \range{result}{result + $N$}. -The elements in the constructed range are sorted. \pnum \returns @@ -10849,10 +10870,9 @@ for the overloads in namespace \tcode{ranges}, if $N$ is equal to $M + K$. \item - Otherwise, \tcode{\{j1, j2, result_last\}} + Otherwise, \tcode{\{first1 + $A$, first2 + $B$, result_last\}} for the overloads in namespace \tcode{ranges}, - where the iterators \tcode{j1} and \tcode{j2} - point to positions past the last copied or skipped elements + where $A$ and $B$ are the numbers of copied or skipped elements in \range{first1}{last1} and \range{first2}{last2}, respectively. \end{itemize} @@ -10864,14 +10884,6 @@ \pnum \remarks Stable\iref{algorithm.stable}. -If \range{first1}{last1} contains $m$ elements -that are equivalent to each other and -\range{first2}{last2} contains $n$ elements -that are equivalent to them, -then $|m - n|$ of those elements shall be copied to the output range: -the last $m - n$ of these elements from \range{first1}{last1} if $m > n$, and -the last $n - m$ of these elements from \range{first2}{last2} if $m < n$. -In either case, the elements are copied in order. \end{itemdescr} \rSec2[alg.heap.operations]{Heap operations} diff --git a/source/containers.tex b/source/containers.tex index d2db2ed385..cae6d5fc2f 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -7930,8 +7930,11 @@ that provides constant-time insertion and erasure operations. Storage is automatically managed in multiple memory blocks, referred to as \defnx{element blocks}{element block}. -Insertion position is determined by the container, and insertion +Insertion\iref{hive.modifiers} position is determined by the container, and insertion may re-use the memory locations of erased elements. +\begin{note} +Construction and assignment are not considered to involve insertion operations. +\end{note} \pnum Element blocks which contain elements are referred to @@ -8253,7 +8256,7 @@ \begin{itemdescr} \pnum \effects -Constructs a \tcode{hive} object with the elements of the range \tcode{rg}, +Constructs a \tcode{hive} object equal to the range \tcode{rg}, using the specified allocator. If the second overload is called, also initializes \exposid{current-limits} with \tcode{block_limits}. @@ -8276,7 +8279,7 @@ \pnum \effects -Constructs a \tcode{hive} object with the elements of \tcode{x}. +Constructs a \tcode{hive} object equal to \tcode{x}. If the second overload is called, uses \tcode{alloc}. Initializes \exposid{current-limits} with \tcode{x.\exposid{current-limits}}. @@ -8319,6 +8322,8 @@ \pnum \ensures \tcode{x.empty()} is \tcode{true}. +The relative order of the elements of \tcode{*this} +is the same as that of the elements of \tcode{x} prior to the call. \pnum \complexity @@ -8340,7 +8345,7 @@ \pnum \effects -Constructs a \tcode{hive} object with the elements of \tcode{il}, +Constructs a \tcode{hive} object equal to \tcode{il}, using the specified allocator. If the second overload is called, also initializes \exposid{current-limits} with \tcode{block_limits}. @@ -8364,7 +8369,8 @@ \pnum \effects All elements in \tcode{*this} are either copy-assigned to, or destroyed. -All elements in \tcode{x} are copied into \tcode{*this}. +All elements in \tcode{x} are copied into \tcode{*this}, +maintaining their relative order. \begin{note} \exposid{current-limits} is unchanged. \end{note} @@ -8423,6 +8429,8 @@ \pnum \ensures \tcode{x.empty()} is \tcode{true}. +The relative order of the elements of \tcode{*this} +is the same as that of the elements of \tcode{x} prior to this call. \pnum \complexity @@ -8479,7 +8487,6 @@ \pnum \remarks -The size of the sequence is not changed. All references, pointers, and iterators referring to elements in \tcode{*this}, as well as the past-the-end iterator, remain valid. \end{itemdescr} @@ -8533,7 +8540,10 @@ \effects For the first overload, all reserved blocks are deallocated, and \tcode{capacity()} is reduced accordingly. -For the second overload, \tcode{capacity()} is reduced to no less than \tcode{n}. +For the second overload, +if \tcode{n >= capacity()} is \tcode{true}, +there are no effects; +otherwise, \tcode{capacity()} is reduced to no less than \tcode{n}. \pnum \complexity @@ -8825,6 +8835,8 @@ \effects If \tcode{addressof(x) == this} is \tcode{true}, the behavior is erroneous and there are no effects. +If an exceptions is thrown, +there are no effects. Otherwise, inserts the contents of \tcode{x} into \tcode{*this} and \tcode{x} becomes empty. Pointers and references to the moved elements of \tcode{x} diff --git a/source/exec.tex b/source/exec.tex index 6e99784a93..0cb6804b60 100644 --- a/source/exec.tex +++ b/source/exec.tex @@ -4204,6 +4204,27 @@ if \tcode{Tag} denotes a type other than \tcode{set_value_t} or if the expression \tcode{f(auto(shape), auto(shape), args...)} is well-formed. +\begin{itemdecl} +template + static consteval void \exposid{check-types}(); +\end{itemdecl} + +\begin{itemdescr} +\pnum +\effects +Equivalent to: +\begin{codeblock} +auto cs = get_completion_signatures<@\exposid{child-type}@, @\exposid{FWD-ENV-T}@(Env)...>(); +auto fn = [](set_value_t(*)(Ts...)) { + using data_type = @\exposid{data-type}@; + if constexpr (!invocable&, + remove_cvref_t<@\exposid{data-type}@>, Ts&...>) + throw @\placeholder{unspecified-exception}@(); +}; +cs.@\exposid{for-each}@(@\exposid{overload-set}@(fn, [](auto){})); +\end{codeblock} +\end{itemdescr} + \pnum The exposition-only class template \exposid{impls-for}\iref{exec.snd.expos} is specialized for \tcode{bulk_unchunked_t} as follows: @@ -4212,6 +4233,9 @@ template<> struct @\exposid{impls-for}@ : @\exposid{default-impls}@ { static constexpr auto @\exposid{complete}@ = @\seebelow@; + + template + static consteval void \exposid{check-types}(); }; } \end{codeblock} @@ -4253,7 +4277,9 @@ \begin{codeblock} auto cs = get_completion_signatures<@\exposid{child-type}@, @\exposid{FWD-ENV-T}@(Env)...>(); auto fn = [](set_value_t(*)(Ts...)) { - if constexpr (!@\libconcept{invocable}@>, Ts&...>) + using data_type = @\exposid{data-type}@; + if constexpr (!@\libconcept{invocable}@&, + remove_cvref_t<@\exposid{data-type}@>, Ts&...>) throw @\placeholder{unspecified-exception}@(); }; cs.@\exposid{for-each}@(@\exposid{overload-set}@(fn, [](auto){})); @@ -5385,10 +5411,7 @@ void @\exposid{abandon}@() noexcept; // \expos private: - using @\exposid{alloc-t}@ = // \expos - allocator_traits::template rebind_alloc<@\exposid{spawn-future-state}@>; - - @\exposid{alloc-t}@ @\exposid{alloc}@; // \expos + Alloc @\exposid{alloc}@; // \expos @\exposid{ssource-t}@ @\exposid{ssource}@; // \expos @\exposid{op-t}@ @\exposid{op}@; // \expos Token @\exposid{token}@; // \expos @@ -5396,6 +5419,10 @@ void @\exposid{destroy}@() noexcept; // \expos }; + + template // \expos + \exposid{spawn-future-state}(Alloc alloc, Sender&& sndr, Token token, Env env) + -> \exposid{spawn-future-state}; } \end{codeblock} @@ -5498,10 +5525,10 @@ bool associated = this->@\exposid{associated}@; { - auto alloc = std::move(this->@\exposid{alloc}@); - - allocator_traits<@\exposid{alloc-t}@>::destroy(alloc, this); - allocator_traits<@\exposid{alloc-t}@>::deallocate(alloc, this, 1); + using traits = allocator_traits::template rebind_traits<\exposid{spawn-future-state}>; + typename traits::allocator_type alloc(std::move(this->\exposid{alloc})); + traits::destroy(alloc, this); + traits::deallocate(alloc, this, 1); } if (associated) @@ -5559,8 +5586,8 @@ \begin{itemize} \item -Uses \tcode{alloc} to allocate and construct an object \tcode{s} of -a type that is a specialization of \exposid{spawn-future-\brk{}state} +Uses \tcode{alloc} to allocate and construct an object \tcode{s} of type +\tcode{decltype(\exposid{spawn-future-state}(alloc, token.wrap(sndr), token, senv))} from \tcode{alloc}, \tcode{token.wrap(sndr)}, \tcode{token}, and \tcode{senv}. If an exception is thrown then any constructed objects are destroyed and @@ -5900,10 +5927,7 @@ void @\exposid{run}@(); // \expos private: - using @\exposid{alloc-t}@ = // \expos - allocator_traits::template rebind_alloc<@\exposid{spawn-state}@>; - - @\exposid{alloc-t}@ @\exposid{alloc}@; // \expos + Alloc @\exposid{alloc}@; // \expos @\exposid{op-t}@ @\exposid{op}@; // \expos Token @\exposid{token}@; // \expos @@ -5973,10 +5997,10 @@ \effects Equivalent to: \begin{codeblock} -auto alloc = std::move(this->@\exposid{alloc}@); - -allocator_traits<@\exposid{alloc-t}@>::destroy(alloc, this); -allocator_traits<@\exposid{alloc-t}@>::deallocate(alloc, this, 1); +using traits = allocator_traits::template rebind_traits<\exposid{spawn-state}>; +typename traits::allocator_type alloc(std::move(this->\exposid{alloc})); +traits::destroy(alloc, this); +traits::deallocate(alloc, this, 1); \end{codeblock} \end{itemdescr} @@ -6006,9 +6030,9 @@ %%FIXME: Was this supposed to be more than a single bullet? \begin{itemize} \item -Uses \tcode{alloc} to allocate and construct an object \tcode{o} of -type that is a specialization of \tcode{\exposid{spawn-state}} from -\tcode{alloc}, \tcode{write_env(token.wrap(sndr), senv)}, and \tcode{token} +Uses \tcode{alloc} to allocate and construct an object \tcode{o} of type +\tcode{decltype(\exposid{spawn-state}(alloc, write_env(token.wrap(sndr), senv), token))} +from \tcode{alloc}, \tcode{write_env(token.wrap(sndr), senv)}, and \tcode{token} and then invokes \tcode{o.\exposid{run}()}. If an exception is thrown then diff --git a/source/meta.tex b/source/meta.tex index f0bd37f53d..91c7469429 100644 --- a/source/meta.tex +++ b/source/meta.tex @@ -6699,6 +6699,12 @@ \pnum \returns \tcode{class_type}. + +\pnum +\remarks +If $C$ is a specialization of a templated class and +it has not been instantiated, +$C$ is treated as an explicit specialization. \end{itemdescr} \rSec2[meta.reflection.traits]{Reflection type traits} diff --git a/source/utilities.tex b/source/utilities.tex index 5e93b63c63..3db8629921 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -1662,9 +1662,9 @@ public: // \ref{tuple.cnstr}, \tcode{tuple} construction constexpr explicit(@\seebelow@) tuple(); - constexpr explicit(@\seebelow@) tuple(const Types&...); // only if \tcode{sizeof...(Types) >= 1} + constexpr explicit(@\seebelow@) tuple(const Types&...) noexcept(@\seebelow@); // only if \tcode{sizeof...(Types) >= 1} template - constexpr explicit(@\seebelow@) tuple(UTypes&&...); // only if \tcode{sizeof...(Types) >= 1} + constexpr explicit(@\seebelow@) tuple(UTypes&&...) noexcept(@\seebelow@); // only if \tcode{sizeof...(Types) >= 1} tuple(const tuple&) = default; tuple(tuple&&) = default; @@ -1840,7 +1840,8 @@ \indexlibraryctor{tuple}% \begin{itemdecl} -constexpr explicit(@\seebelow@) tuple(const Types&...); +constexpr explicit(@\seebelow@) tuple(const Types&...) + noexcept((is_nothrow_copy_constructible_v && ...)); \end{itemdecl} \begin{itemdescr} @@ -1864,7 +1865,8 @@ \indexlibraryctor{tuple}% \begin{itemdecl} -template constexpr explicit(@\seebelow@) tuple(UTypes&&... u); +template constexpr explicit(@\seebelow@) tuple(UTypes&&... u) + noexcept((is_nothrow_constructible_v && ...)); \end{itemdecl} \begin{itemdescr} @@ -2828,6 +2830,7 @@ the template is available when any of the headers \libheaderref{array}, +\libheaderref{complex}, \libheaderref{ranges}, or \libheaderref{utility} are included. @@ -2849,6 +2852,7 @@ the template is available when any of the headers \libheaderref{array}, +\libheaderref{complex}, \libheaderref{ranges}, or \libheaderref{utility} are included.