From 047248791efb3d01349c34dada1481218029d47c Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 17:32:11 -0700 Subject: [PATCH 01/26] LWG3564 transform_view::iterator::value_type and iterator_category should use const F& --- source/ranges.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/ranges.tex b/source/ranges.tex index c1b1795099..108e945d0f 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -4430,7 +4430,7 @@ using iterator_concept = @\seebelownc@; using iterator_category = @\seebelownc@; // not always present using value_type = - remove_cvref_t>>; + remove_cvref_t&, range_reference_t<@\exposid{Base}@>>>; using difference_type = range_difference_t<@\exposid{Base}@>; @\exposid{iterator}@() requires @\libconcept{default_initializable}@> = default; @@ -4514,7 +4514,7 @@ \tcode{iterator_traits>::iterator_category}. \begin{itemize} \item -If \tcode{is_lvalue_reference_v>>} +If \tcode{is_lvalue_reference_v\&, range_reference_t<\linebreak\exposid{Base}>>>} is \tcode{true}, then \begin{itemize} \item From c5b6a5c3827f1726982ef92a9c2e33de4a00fc11 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 17:50:07 -0700 Subject: [PATCH 02/26] LWG3617 function/packaged_task deduction guides and deducing this --- source/threads.tex | 6 ++++-- source/utilities.tex | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/threads.tex b/source/threads.tex index 16de6eba03..ce82da2d9b 100644 --- a/source/threads.tex +++ b/source/threads.tex @@ -11316,9 +11316,11 @@ \begin{itemize} \item \tcode{F::operator()} is a non-static member function and -\tcode{decltype(\brk{}\&F::operator())} is of the form +\tcode{decltype(\brk{}\&F::operator())} is either of the form \tcode{R(G::*)(A...)}~\cv{}~\tcode{\opt{\&}~\opt{noexcept}} -for a class type \tcode{G}, or +or of the form +\tcode{R(*)(G, A...)~\opt{noexcept}} +for a type \tcode{G}, or \item \tcode{F::operator()} is a static member function and \tcode{decltype(\&F::operator())} is of the form diff --git a/source/utilities.tex b/source/utilities.tex index 39ab1f815e..0c1675b040 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -11679,9 +11679,11 @@ \begin{itemize} \item \tcode{F::operator()} is a non-static member function and -\tcode{decltype(\brk{}\&F::operator())} is of the form +\tcode{decltype(\brk{}\&F::operator())} is either of the form \tcode{R(G::*)(A...)}~\cv{}~\tcode{\opt{\&}~\opt{noexcept}} -for a class type \tcode{G}, or +or of the form +\tcode{R(*)(G, A...)~\opt{noexcept}} +for a type \tcode{G}, or \item \tcode{F::operator()} is a static member function and \tcode{decltype(\&F::operator())} is of the form From 53c83cfe56bae547c4fce7c1a5a0e324818e7d37 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 17:52:16 -0700 Subject: [PATCH 03/26] LWG3656 Inconsistent bit operations returning a count --- source/utilities.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/utilities.tex b/source/utilities.tex index 0c1675b040..32e2090138 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -15518,7 +15518,7 @@ template constexpr T bit_floor(T x) noexcept; template - constexpr T bit_width(T x) noexcept; + constexpr int bit_width(T x) noexcept; // \ref{bit.rotate}, rotating template @@ -15702,7 +15702,7 @@ \indexlibraryglobal{bit_width}% \begin{itemdecl} template - constexpr T bit_width(T x) noexcept; + constexpr int bit_width(T x) noexcept; \end{itemdecl} \begin{itemdescr} From c61c1b6284041c528a619fedb9097c0ff0a53301 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 18:02:02 -0700 Subject: [PATCH 04/26] LWG3659 Consider ATOMIC_FLAG_INIT undeprecation --- source/future.tex | 24 ------------------------ source/threads.tex | 22 ++++++++++++++++++++++ source/xrefdelta.tex | 3 +++ 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/source/future.tex b/source/future.tex index 609e7cfceb..2f13822f8f 100644 --- a/source/future.tex +++ b/source/future.tex @@ -2639,8 +2639,6 @@ void atomic_init(atomic*, typename atomic::value_type) noexcept; #define ATOMIC_VAR_INIT(value) @\seebelow@ - - #define ATOMIC_FLAG_INIT @\seebelow@ } \end{codeblock} @@ -2709,25 +2707,3 @@ \end{codeblock} \end{example} \end{itemdescr} - -\rSec2[depr.atomics.flag]{Flag type and operations} - -\indexlibraryglobal{ATOMIC_FLAG_INIT}% -\begin{itemdecl} -#define ATOMIC_FLAG_INIT @\seebelow@ -\end{itemdecl} - -\begin{itemdescr} -\pnum -\remarks -The macro \tcode{ATOMIC_FLAG_INIT} is defined in such a way that -it can be used to initialize an object of type \tcode{atomic_flag} -to the clear state. -The macro can be used in the form: -\begin{codeblock} -atomic_flag guard = ATOMIC_FLAG_INIT; -\end{codeblock} -It is unspecified whether the macro can be used -in other initialization contexts. -For a complete static-duration object, that initialization shall be static. -\end{itemdescr} diff --git a/source/threads.tex b/source/threads.tex index ce82da2d9b..e9988ec37f 100644 --- a/source/threads.tex +++ b/source/threads.tex @@ -2298,6 +2298,7 @@ void atomic_flag_notify_one(atomic_flag*) noexcept; void atomic_flag_notify_all(volatile atomic_flag*) noexcept; void atomic_flag_notify_all(atomic_flag*) noexcept; + #define ATOMIC_FLAG_INIT @\seebelow@ // \ref{atomics.fences}, fences extern "C" void atomic_thread_fence(memory_order) noexcept; @@ -5651,6 +5652,26 @@ This function is an atomic notifying operation\iref{atomics.wait}. \end{itemdescr} +\indexlibraryglobal{ATOMIC_FLAG_INIT}% +\begin{itemdecl} +#define ATOMIC_FLAG_INIT @\seebelow@ +\end{itemdecl} + +\begin{itemdescr} +\pnum +\remarks +The macro \tcode{ATOMIC_FLAG_INIT} is defined in such a way that +it can be used to initialize an object of type \tcode{atomic_flag} +to the clear state. +The macro can be used in the form: +\begin{codeblock} +atomic_flag guard = ATOMIC_FLAG_INIT; +\end{codeblock} +It is unspecified whether the macro can be used +in other initialization contexts. +For a complete static-duration object, that initialization shall be static. +\end{itemdescr} + \rSec2[atomics.fences]{Fences} \pnum @@ -5827,6 +5848,7 @@ using std::@\libglobal{atomic_flag_test_and_set_explicit}@; // \seebelow using std::@\libglobal{atomic_flag_clear}@; // \seebelow using std::@\libglobal{atomic_flag_clear_explicit}@; // \seebelow +#define ATOMIC_FLAG_INIT @\seebelow@ using std::@\libglobal{atomic_thread_fence}@; // \seebelow using std::@\libglobal{atomic_signal_fence}@; // \seebelow diff --git a/source/xrefdelta.tex b/source/xrefdelta.tex index 9677de5fb1..8c6dd51293 100644 --- a/source/xrefdelta.tex +++ b/source/xrefdelta.tex @@ -99,5 +99,8 @@ % P1467R9 Extended floating-point types and standard names \movedxref{complex.special}{complex.members} +% LWG3659 Consider ATOMIC_FLAG_INIT undeprecation +\removedxref{depr.atomics.flag} + % Deprecated features. %\deprxref{old.label} (if moved to depr.old.label, otherwise use \movedxref) From 6fbded2b5079afbff6af3a6e2f828541bb4477e8 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 18:11:01 -0700 Subject: [PATCH 05/26] LWG3670 Cpp17InputIterators don't have integer-class difference types --- source/ranges.tex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/ranges.tex b/source/ranges.tex index 108e945d0f..a8352fdb65 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -2767,7 +2767,8 @@ W @\exposid{value_}@ = W(); // \expos public: using iterator_concept = @\seebelow@; - using iterator_category = input_iterator_tag; // present only if \tcode{W} models \libconcept{incrementable} + using iterator_category = input_iterator_tag; // present only if \tcode{W} models \libconcept{incrementable} and + // \tcode{\placeholdernc{IOTA-DIFF-T}(W)} is an integral type using value_type = W; using difference_type = @\placeholdernc{IOTA-DIFF-T}@(W); From 50f1e241b042549394950195f8494917d0692478 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 18:21:00 -0700 Subject: [PATCH 06/26] LWG3671 atomic_fetch_xor missing from stdatomic.h --- source/threads.tex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/threads.tex b/source/threads.tex index e9988ec37f..020915bf95 100644 --- a/source/threads.tex +++ b/source/threads.tex @@ -5840,10 +5840,12 @@ using std::@\libglobal{atomic_fetch_add_explicit}@; // \seebelow using std::@\libglobal{atomic_fetch_sub}@; // \seebelow using std::@\libglobal{atomic_fetch_sub_explicit}@; // \seebelow -using std::@\libglobal{atomic_fetch_or}@; // \seebelow -using std::@\libglobal{atomic_fetch_or_explicit}@; // \seebelow using std::@\libglobal{atomic_fetch_and}@; // \seebelow using std::@\libglobal{atomic_fetch_and_explicit}@; // \seebelow +using std::@\libglobal{atomic_fetch_or}@; // \seebelow +using std::@\libglobal{atomic_fetch_or_explicit}@; // \seebelow +using std::@\libglobal{atomic_fetch_xor}@; // \seebelow +using std::@\libglobal{atomic_fetch_xor_explicit}@; // \seebelow using std::@\libglobal{atomic_flag_test_and_set}@; // \seebelow using std::@\libglobal{atomic_flag_test_and_set_explicit}@; // \seebelow using std::@\libglobal{atomic_flag_clear}@; // \seebelow From 0df9a20af999f12479d9bf65fbd714407bdfe1fe Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 18:24:25 -0700 Subject: [PATCH 07/26] LWG3672 common_iterator::operator->() should return by value --- source/iterators.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/iterators.tex b/source/iterators.tex index 0b49fb07bc..9c9606b0ae 100644 --- a/source/iterators.tex +++ b/source/iterators.tex @@ -4796,7 +4796,7 @@ constexpr decltype(auto) operator*(); constexpr decltype(auto) operator*() const requires @\exposconcept{dereferenceable}@; - constexpr decltype(auto) operator->() const + constexpr auto operator->() const requires @\seebelow@; constexpr common_iterator& operator++(); @@ -4964,7 +4964,7 @@ \indexlibrarymember{operator->}{common_iterator}% \begin{itemdecl} -constexpr decltype(auto) operator->() const +constexpr auto operator->() const requires @\seebelow@; \end{itemdecl} From da4456dde74b4f5dfd5899cec4f74e1a0f0e90dd Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 18:27:26 -0700 Subject: [PATCH 08/26] LWG3683 operator== for polymorphic_allocator cannot deduce template argument in common cases --- source/memory.tex | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/memory.tex b/source/memory.tex index 349c18b115..8491e64339 100644 --- a/source/memory.tex +++ b/source/memory.tex @@ -5442,6 +5442,12 @@ polymorphic_allocator select_on_container_copy_construction() const; memory_resource* resource() const; + + // friends + friend bool operator==(const polymorphic_allocator& a, + const polymorphic_allocator& b) noexcept { + return *a.resource() == *b.resource(); + } }; } \end{codeblock} From 29f66da4515576f0bf2cc3c3868e6afbb3e25d5f Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 18:29:17 -0700 Subject: [PATCH 09/26] LWG3687 expected move constructor should move --- source/utilities.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/utilities.tex b/source/utilities.tex index 32e2090138..e18b6b2e80 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -8268,7 +8268,7 @@ Otherwise, if \tcode{rhs.has_value()} is \tcode{true}, destroys \exposid{unex} and sets \exposid{has_val} to \tcode{true}. \item -Otherwise, equivalent to \tcode{\exposid{unex} = rhs.error()}. +Otherwise, equivalent to \tcode{\exposid{unex} = std::move(rhs.error())}. \end{itemize} \pnum From 76a86b85bf91c1afcd8b04e5a69e5257c2ceea44 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 18:38:22 -0700 Subject: [PATCH 10/26] LWG3692 zip_view::iterator's operator<=> is overconstrained --- source/ranges.tex | 58 ++--------------------------------------------- 1 file changed, 2 insertions(+), 56 deletions(-) diff --git a/source/ranges.tex b/source/ranges.tex index a8352fdb65..3e6b849d09 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -8742,17 +8742,8 @@ friend constexpr bool operator==(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires (@\libconcept{equality_comparable}@>> && ...); - friend constexpr bool operator<(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\exposconcept{all-random-access}@; - friend constexpr bool operator>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\exposconcept{all-random-access}@; - friend constexpr bool operator<=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\exposconcept{all-random-access}@; - friend constexpr bool operator>=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\exposconcept{all-random-access}@; friend constexpr auto operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\exposconcept{all-random-access}@ && - (@\libconcept{three_way_comparable}@>> && ...); + requires @\exposconcept{all-random-access}@; friend constexpr @\exposid{iterator}@ operator+(const @\exposid{iterator}@& i, difference_type n) requires @\exposconcept{all-random-access}@; @@ -8974,54 +8965,9 @@ \end{itemize} \end{itemdescr} -\begin{itemdecl} -friend constexpr bool operator<(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\exposconcept{all-random-access}@; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\returns -\tcode{x.\exposid{current_} < y.\exposid{current_}}. -\end{itemdescr} - -\begin{itemdecl} -friend constexpr bool operator>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\exposconcept{all-random-access}@; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\effects -Equivalent to: \tcode{return y < x;} -\end{itemdescr} - -\begin{itemdecl} -friend constexpr bool operator<=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\exposconcept{all-random-access}@; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\effects -Equivalent to: \tcode{return !(y < x);} -\end{itemdescr} - -\begin{itemdecl} -friend constexpr bool operator>=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\exposconcept{all-random-access}@; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\effects -Equivalent to: \tcode{return !(x < y);} -\end{itemdescr} - \begin{itemdecl} friend constexpr auto operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\exposconcept{all-random-access}@ && - (@\libconcept{three_way_comparable}@>> && ...); + requires @\exposconcept{all-random-access}@; \end{itemdecl} \begin{itemdescr} From 62e3587d33966bac05f818fddcd3797d340b0a62 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 18:41:06 -0700 Subject: [PATCH 11/26] LWG3701 Make formatter, charT> requirement explicit --- source/utilities.tex | 1 + 1 file changed, 1 insertion(+) diff --git a/source/utilities.tex b/source/utilities.tex index e18b6b2e80..c131219fff 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -14648,6 +14648,7 @@ \begin{codeblock} template<> struct formatter; template<> struct formatter; +template struct formatter; template struct formatter; template struct formatter, charT>; From d29b963648c48de3184787281325d6e814140e11 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 18:45:29 -0700 Subject: [PATCH 12/26] LWG3702 Should zip_transform_view::iterator remove operator>; - friend constexpr bool operator<(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\libconcept{random_access_range}@<@\exposid{Base}@>; - friend constexpr bool operator>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\libconcept{random_access_range}@<@\exposid{Base}@>; - friend constexpr bool operator<=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\libconcept{random_access_range}@<@\exposid{Base}@>; - friend constexpr bool operator>=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\libconcept{random_access_range}@<@\exposid{Base}@>; friend constexpr auto operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\libconcept{random_access_range}@<@\exposid{Base}@> && @\libconcept{three_way_comparable}@<@\exposid{ziperator}@>; + requires @\libconcept{random_access_range}@<@\exposid{Base}@>; friend constexpr @\exposid{iterator}@ operator+(const @\exposid{iterator}@& i, difference_type n) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -9587,16 +9579,8 @@ \begin{itemdecl} friend constexpr bool operator==(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{equality_comparable}@<@\exposid{ziperator}@>; -friend constexpr bool operator<(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\libconcept{random_access_range}@<@\exposid{Base}@>; -friend constexpr bool operator>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\libconcept{random_access_range}@<@\exposid{Base}@>; -friend constexpr bool operator<=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\libconcept{random_access_range}@<@\exposid{Base}@>; -friend constexpr bool operator>=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\libconcept{random_access_range}@<@\exposid{Base}@>; friend constexpr auto operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\libconcept{random_access_range}@<@\exposid{Base}@> && @\libconcept{three_way_comparable}@<@\exposid{ziperator}@>; + requires @\libconcept{random_access_range}@<@\exposid{Base}@>; \end{itemdecl} \begin{itemdescr} From 62fe2a0689653ff2a89da0285edb1a0ba01a8b82 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 18:55:59 -0700 Subject: [PATCH 13/26] LWG3703 Missing requirements for expected requires is_void --- source/utilities.tex | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/source/utilities.tex b/source/utilities.tex index c131219fff..4bb00cb94f 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -6933,11 +6933,7 @@ Implementations are not permitted to use additional storage, such as dynamic memory, to allocate the object of type \tcode{T} or the object of type \tcode{E}. -These objects are allocated in a region of the \tcode{expected} storage -suitably aligned for the types \tcode{T} and \tcode{E}. -Members \exposid{has_val}, \exposid{val}, and \exposid{unex} -are provided for exposition only. -\exposid{has_val} indicates whether the \tcode{expected} object +Member \exposid{has_val} indicates whether the \tcode{expected} object contains an object of type \tcode{T}. \pnum @@ -7977,6 +7973,21 @@ }; \end{codeblock} +\pnum +Any object of type \tcode{expected} either +represents a value of type \tcode{T}, or +contains a value of type \tcode{E} within its own storage. +Implementations are not permitted to use additional storage, +such as dynamic memory, to allocate the object of type \tcode{E}. +Member \exposid{has_val} indicates whether the \tcode{expected} object +represents a value of type \tcode{T}. + +\pnum +A program that instantiates +the definition of the template \tcode{expected} with +a type for the \tcode{E} parameter that +is not a valid template argument for \tcode{unexpected} is ill-formed. + \pnum \tcode{E} shall meet the requirements of \oldconcept{Destructible} (\tref{cpp17.destructible}). From a7cbca78450f81ce7702b01e017e4a1f17e98fe9 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 19:02:11 -0700 Subject: [PATCH 14/26] LWG3704 LWG 2059 added overloads that might be ill-formed for sets --- source/containers.tex | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/containers.tex b/source/containers.tex index bf2b4b012c..72cabef394 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -10515,7 +10515,8 @@ insert_return_type insert(node_type&& nh); iterator insert(const_iterator hint, node_type&& nh); - iterator erase(iterator position); + iterator erase(iterator position) + requires (!@\libconcept{same_as}@); iterator erase(const_iterator position); size_type erase(const key_type& x); template size_type erase(K&& x); @@ -10827,7 +10828,8 @@ iterator insert(node_type&& nh); iterator insert(const_iterator hint, node_type&& nh); - iterator erase(iterator position); + iterator erase(iterator position) + requires (!@\libconcept{same_as}@); iterator erase(const_iterator position); size_type erase(const key_type& x); template size_type erase(K&& x); @@ -12359,7 +12361,8 @@ insert_return_type insert(node_type&& nh); iterator insert(const_iterator hint, node_type&& nh); - iterator erase(iterator position); + iterator erase(iterator position) + requires (!@\libconcept{same_as}@); iterator erase(const_iterator position); size_type erase(const key_type& k); template size_type erase(K&& x); @@ -12732,7 +12735,8 @@ iterator insert(node_type&& nh); iterator insert(const_iterator hint, node_type&& nh); - iterator erase(iterator position); + iterator erase(iterator position) + requires (!@\libconcept{same_as}@); iterator erase(const_iterator position); size_type erase(const key_type& k); template size_type erase(K&& x); From f8f6265f6b72678ed95901db776561db9642eda0 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 19:17:54 -0700 Subject: [PATCH 15/26] LWG3705 Hashability shouldn't depend on basic_string's allocator --- source/strings.tex | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/source/strings.tex b/source/strings.tex index 8e9ae733a0..ad2a4aeee8 100644 --- a/source/strings.tex +++ b/source/strings.tex @@ -1972,16 +1972,11 @@ // \ref{basic.string.hash}, hash support template struct hash; - template<> struct hash; - template<> struct hash; - template<> struct hash; - template<> struct hash; - template<> struct hash; - template<> struct hash; - template<> struct hash; - template<> struct hash; - template<> struct hash; - template<> struct hash; + template struct hash, A>>; + template struct hash, A>>; + template struct hash, A>>; + template struct hash, A>>; + template struct hash, A>>; inline namespace literals { inline namespace string_literals { @@ -5290,25 +5285,13 @@ \rSec2[basic.string.hash]{Hash support} -\indexlibrarymember{hash}{string}% -\indexlibrarymember{hash}{u16string}% -\indexlibrarymember{hash}{u32string}% -\indexlibrarymember{hash}{wstring}% -\indexlibrarymember{hash}{pmr::string}% -\indexlibrarymember{hash}{pmr::u16string}% -\indexlibrarymember{hash}{pmr::u32string}% -\indexlibrarymember{hash}{pmr::wstring}% -\begin{itemdecl} -template<> struct hash; -template<> struct hash; -template<> struct hash; -template<> struct hash; -template<> struct hash; -template<> struct hash; -template<> struct hash; -template<> struct hash; -template<> struct hash; -template<> struct hash; +\indexlibrarymember{hash}{basic_string}% +\begin{itemdecl} +template struct hash, A>>; +template struct hash, A>>; +template struct hash, A>>; +template struct hash, A>>; +template struct hash, A>>; \end{itemdecl} \begin{itemdescr} From 7ecb746a0c41c60e4117da644e7d1ebe70b2f3cd Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 19:25:58 -0700 Subject: [PATCH 16/26] LWG3707 chunk_view::outer-iterator::value_type::size should return unsigned type --- source/ranges.tex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/ranges.tex b/source/ranges.tex index dbbaff6822..0417a4cb02 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -11198,7 +11198,8 @@ \effects Equivalent to: \begin{codeblock} -return ranges::min(@\exposid{parent_}@->@\exposid{remainder_}@, ranges::end(@\exposid{parent_}@->@\exposid{base_}@) - *@\exposid{parent_}@->@\exposid{current_}@); +return @\exposid{to-unsigned-like}@(ranges::min(@\exposid{parent_}@->@\exposid{remainder_}@, + ranges::end(@\exposid{parent_}@->@\exposid{base_}@) - *@\exposid{parent_}@->@\exposid{current_}@)); \end{codeblock} \end{itemdescr} From d6a68e3622a40a52154a6e23bc42e4de1215c03d Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 19:27:47 -0700 Subject: [PATCH 17/26] LWG3708 take_while_view::sentinel's conversion constructor should move --- source/ranges.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ranges.tex b/source/ranges.tex index 0417a4cb02..eec7445251 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -5323,7 +5323,7 @@ \begin{itemdescr} \pnum \effects -Initializes \exposid{end_} with \tcode{s.\exposid{end_}} and +Initializes \exposid{end_} with \tcode{std::move(s.\exposid{end_})} and \exposid{pred_} with \tcode{s.\exposid{pred_}}. \end{itemdescr} From 60fa43a5959aee254033440771a02a875993cc82 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 19:30:47 -0700 Subject: [PATCH 18/26] LWG3709 LWG-3703 was underly ambitious --- source/utilities.tex | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source/utilities.tex b/source/utilities.tex index 4bb00cb94f..8b632563dc 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -2905,13 +2905,13 @@ it means that an object of type \tcode{T}, referred to as the optional object's \defnx{contained value}{contained value!\idxcode{optional}}, is allocated within the storage of the optional object. Implementations are not permitted to use additional storage, such as dynamic memory, to allocate its contained value. -The contained value shall be allocated in a region of the \tcode{optional} storage suitably aligned for the type \tcode{T}. When an object of type \tcode{optional} is contextually converted to \tcode{bool}, the conversion returns \tcode{true} if the object contains a value; otherwise the conversion returns \tcode{false}. \pnum -Member \tcode{val} is provided for exposition only. When an \tcode{optional} object contains a value, \tcode{val} points to the contained value. +When an \tcode{optional} object contains a value, +member \tcode{val} points to the contained value. \pnum \tcode{T} shall be a type @@ -4635,8 +4635,6 @@ \tcode{variant} object. Implementations are not permitted to use additional storage, such as dynamic memory, to allocate the contained value. -The contained value shall be allocated in a region of the \tcode{variant} -storage suitably aligned for all types in \tcode{Types}. \pnum All types in \tcode{Types} shall meet From d7a01d97fc63b692df1d4aa2f8b5266236daa5b7 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 19:32:09 -0700 Subject: [PATCH 19/26] LWG3710 The end of chunk_view for input ranges can be const --- source/ranges.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/ranges.tex b/source/ranges.tex index eec7445251..672671a0f3 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -10939,7 +10939,7 @@ constexpr V base() && { return std::move(@\exposid{base_}@); } constexpr @\exposid{outer-iterator}@ begin(); - constexpr default_sentinel_t end() noexcept; + constexpr default_sentinel_t end() const noexcept; constexpr auto size() requires @\libconcept{sized_range}@; constexpr auto size() const requires @\libconcept{sized_range}@; @@ -10981,7 +10981,7 @@ \end{itemdescr} \begin{itemdecl} -constexpr default_sentinel_t end() noexcept; +constexpr default_sentinel_t end() const noexcept; \end{itemdecl} \begin{itemdescr} From 0416e7ec335257c0d9b2fb1e31d5383dc58aaddf Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 19:35:07 -0700 Subject: [PATCH 20/26] LWG3711 Missing preconditions for slide_view constructor --- source/ranges.tex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/ranges.tex b/source/ranges.tex index 672671a0f3..456fa8c3e8 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -11919,6 +11919,10 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\expects +\tcode{n > 0} is \tcode{true}. + \pnum \effects Initializes \exposid{base_} with \tcode{std::move(base)} and From ab54e00acb64d630cad43b41bf2d97f1fa4de9e1 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 19:40:17 -0700 Subject: [PATCH 21/26] LWG3712 chunk_view and slide_view should not be default_initializable --- source/ranges.tex | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/source/ranges.tex b/source/ranges.tex index 456fa8c3e8..5ae9e88043 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -10919,8 +10919,8 @@ template<@\libconcept{view}@ V> requires @\libconcept{input_range}@ class chunk_view : public view_interface> { - V @\exposid{base_}@ = V(); // \expos - range_difference_t @\exposid{n_}@ = 0; // \expos + V @\exposid{base_}@; // \expos + range_difference_t @\exposid{n_}@; // \expos range_difference_t @\exposid{remainder_}@ = 0; // \expos @\exposid{non-propagating-cache}@> @\exposid{current_}@; // \expos @@ -10932,7 +10932,6 @@ class @\exposid{inner-iterator}@; // \expos public: - chunk_view() requires @\libconcept{default_initializable}@ = default; constexpr explicit chunk_view(V base, range_difference_t n); constexpr V base() const & requires @\libconcept{copy_constructible}@ { return @\exposid{base_}@; } @@ -11351,14 +11350,13 @@ template<@\libconcept{view}@ V> requires @\libconcept{forward_range}@ class chunk_view : public view_interface> { - V @\exposid{base_}@ = V(); // \expos - range_difference_t @\exposid{n_}@ = 0; // \expos + V @\exposid{base_}@; // \expos + range_difference_t @\exposid{n_}@; // \expos // \ref{range.chunk.fwd.iter}, class template \tcode{chunk_view::\exposid{iterator}} template class @\exposid{iterator}@; // \expos public: - chunk_view() requires @\libconcept{default_initializable}@ = default; constexpr explicit chunk_view(V base, range_difference_t n); constexpr V base() const & requires @\libconcept{copy_constructible}@ { return @\exposid{base_}@; } @@ -11884,8 +11882,8 @@ template<@\libconcept{forward_range}@ V> requires @\libconcept{view}@ class slide_view : public view_interface> { - V @\exposid{base_}@ = V(); // \expos - range_difference_t @\exposid{n_}@ = 0; // \expos + V @\exposid{base_}@; // \expos + range_difference_t @\exposid{n_}@; // \expos // \ref{range.slide.iterator}, class template \tcode{slide_view::\exposid{iterator}} template class @\exposid{iterator}@; // \expos @@ -11894,7 +11892,6 @@ class @\exposid{sentinel}@; // \expos public: - slide_view() requires @\libconcept{default_initializable}@ = default; constexpr explicit slide_view(V base, range_difference_t n); constexpr auto begin() From d6d435a867fb2a5c884a84a61f969cf9e999ba00 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 19:57:29 -0700 Subject: [PATCH 22/26] LWG3713 Sorted with respect to comparator (only) [alg.sorting.general] Add index for definition of a sequence sorted with respect to a comparator and projection --- source/algorithms.tex | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/algorithms.tex b/source/algorithms.tex index fbe42e26fa..04cb156bc8 100644 --- a/source/algorithms.tex +++ b/source/algorithms.tex @@ -6206,6 +6206,7 @@ \end{note} \pnum +\indexdefn{sequence!sorted!with respect to a comparator and projection}% A sequence is \term{sorted with respect to a \tcode{comp} and \tcode{proj}} for a comparator and projection \tcode{comp} and \tcode{proj} if for every iterator \tcode{i} pointing to the sequence and @@ -6217,6 +6218,13 @@ \end{codeblock} is \tcode{false}. +\pnum +\indexdefn{sequence!sorted!with respect to a comparator}% +A sequence is \term{sorted with respect to a comparator} \tcode{comp} +for a comparator \tcode{comp} +if it is sorted with respect to +\tcode{comp} and \tcode{identity\{\}} (the identity projection). + \pnum A sequence \range{start}{finish} is \term{partitioned with respect to an expression} \tcode{f(e)} From 81b066eff19b8b07bba3af9d18ee46c2e9101917 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 20:11:47 -0700 Subject: [PATCH 23/26] LWG3715 view_interface::empty is overconstrained --- source/ranges.tex | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/source/ranges.tex b/source/ranges.tex index 5ae9e88043..ead1940263 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -1537,11 +1537,17 @@ } public: - constexpr bool empty() requires @\libconcept{forward_range}@ { - return ranges::begin(@\exposid{derived}@()) == ranges::end(@\exposid{derived}@()); + constexpr bool empty() requires @\libconcept{sized_range}@ || @\libconcept{forward_range}@ { + if constexpr (@\libconcept{sized_range}@) + return ranges::size(@\exposid{derived}@()) == 0; + else + return ranges::begin(@\exposid{derived}@()) == ranges::end(@\exposid{derived}@()); } - constexpr bool empty() const requires @\libconcept{forward_range}@ { - return ranges::begin(@\exposid{derived}@()) == ranges::end(@\exposid{derived}@()); + constexpr bool empty() const requires @\libconcept{sized_range}@ || @\libconcept{forward_range}@ { + if constexpr (@\libconcept{sized_range}@) + return ranges::size(@\exposid{derived}@()) == 0; + else + return ranges::begin(@\exposid{derived}@()) == ranges::end(@\exposid{derived}@()); } constexpr explicit operator bool() From 8d06220f21a833fb55c059a429fe30ad6a1db983 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 20:19:36 -0700 Subject: [PATCH 24/26] LWG3719 Directory iterators should be usable with default sentinel --- source/iostreams.tex | 8 ++++++++ source/regex.tex | 2 ++ 2 files changed, 10 insertions(+) diff --git a/source/iostreams.tex b/source/iostreams.tex index ac91f6ed3a..51e6fb05af 100644 --- a/source/iostreams.tex +++ b/source/iostreams.tex @@ -15757,6 +15757,10 @@ directory_iterator& operator++(); directory_iterator& increment(error_code& ec); + bool operator==(default_sentinel_t) const noexcept { + return *this == directory_iterator(); + } + // other members as required by \ref{input.iterators}, input iterators }; } @@ -16003,6 +16007,10 @@ void pop(error_code& ec); void disable_recursion_pending(); + bool operator==(default_sentinel_t) const noexcept { + return *this == recursive_directory_iterator(); + } + // other members as required by \ref{input.iterators}, input iterators }; } diff --git a/source/regex.tex b/source/regex.tex index 5ee8aa28ed..963a3d0630 100644 --- a/source/regex.tex +++ b/source/regex.tex @@ -3228,6 +3228,7 @@ regex_iterator(const regex_iterator&); regex_iterator& operator=(const regex_iterator&); bool operator==(const regex_iterator&) const; + bool operator==(default_sentinel_t) const { return *this == regex_iterator(); } const value_type& operator*() const; const value_type* operator->() const; regex_iterator& operator++(); @@ -3533,6 +3534,7 @@ regex_token_iterator(const regex_token_iterator&); regex_token_iterator& operator=(const regex_token_iterator&); bool operator==(const regex_token_iterator&) const; + bool operator==(default_sentinel_t) const { return *this == regex_token_iterator(); } const value_type& operator*() const; const value_type* operator->() const; regex_token_iterator& operator++(); From c519b70b0e1c5d8184fab85df0833582ab5e23d0 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 20:21:33 -0700 Subject: [PATCH 25/26] LWG3721 Allow an arg-id with a value of zero for width in std-format-spec --- source/utilities.tex | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source/utilities.tex b/source/utilities.tex index 8b632563dc..642efdf2c9 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -13833,9 +13833,7 @@ a \fmtgrammarterm{width} or \fmtgrammarterm{precision}, the value of the corresponding formatting argument is used in its place. If the corresponding formatting argument is not of integral type, or -its value is -negative for \fmtgrammarterm{precision} or -non-positive for \fmtgrammarterm{width}, +its value is negative, an exception of type \tcode{format_error} is thrown. \pnum From cdd04d631e629215336fc120b43ce4cc76892f6d Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Wed, 27 Jul 2022 20:26:15 -0700 Subject: [PATCH 26/26] LWG3724 decay-copy should be constrained --- source/lib-intro.tex | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/lib-intro.tex b/source/lib-intro.tex index 555f81b7d5..4dbbdcd82b 100644 --- a/source/lib-intro.tex +++ b/source/lib-intro.tex @@ -492,9 +492,11 @@ \indexlibrary{decay-copy@\tcode{\placeholder{decay-copy}}}% \begin{codeblock} namespace std { - template constexpr decay_t @\placeholdernc{decay-copy}@(T&& v) - noexcept(is_nothrow_convertible_v>) // \expos - { return std::forward(v); } + template + requires @\libconcept{convertible_to}@> + constexpr decay_t @\placeholdernc{decay-copy}@(T&& v) + noexcept(is_nothrow_convertible_v>) // \expos + { return std::forward(v); } constexpr auto @\placeholdernc{synth-three-way}@ = [](const T& t, const U& u)