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)} 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); 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/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/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} 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) 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} diff --git a/source/ranges.tex b/source/ranges.tex index c1b1795099..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() @@ -2767,7 +2773,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); @@ -4430,7 +4437,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 +4521,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 @@ -5322,7 +5329,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} @@ -8741,17 +8748,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}@; @@ -8973,54 +8971,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} @@ -9419,16 +9372,8 @@ 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}@>; friend constexpr @\exposid{iterator}@ operator+(const @\exposid{iterator}@& i, difference_type n) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -9640,16 +9585,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} @@ -10988,8 +10925,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 @@ -11001,14 +10938,13 @@ 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_}@; } 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}@; @@ -11050,7 +10986,7 @@ \end{itemdescr} \begin{itemdecl} -constexpr default_sentinel_t end() noexcept; +constexpr default_sentinel_t end() const noexcept; \end{itemdecl} \begin{itemdescr} @@ -11267,7 +11203,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} @@ -11419,14 +11356,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_}@; } @@ -11952,8 +11888,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 @@ -11962,7 +11898,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() @@ -11987,6 +11922,10 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\expects +\tcode{n > 0} is \tcode{true}. + \pnum \effects Initializes \exposid{base_} with \tcode{std::move(base)} and 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++(); 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} diff --git a/source/threads.tex b/source/threads.tex index 16de6eba03..020915bf95 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 @@ -5819,14 +5840,17 @@ 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 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 @@ -11316,9 +11340,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..642efdf2c9 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 @@ -6933,11 +6931,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 +7971,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}). @@ -8268,7 +8277,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 @@ -11679,9 +11688,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 @@ -13822,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 @@ -14646,6 +14655,7 @@ \begin{codeblock} template<> struct formatter; template<> struct formatter; +template struct formatter; template struct formatter; template struct formatter, charT>; @@ -15516,7 +15526,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 @@ -15700,7 +15710,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} 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)