diff --git a/source/algorithms.tex b/source/algorithms.tex index ff4c3b38ed..95933b2119 100644 --- a/source/algorithms.tex +++ b/source/algorithms.tex @@ -10773,11 +10773,9 @@ \rSec3[numeric.sat.func]{Arithmetic functions} \pnum -\begin{note} In the following descriptions, an arithmetic operation is performed as a mathematical operation with infinite range and then it is determined whether the mathematical result fits into the result type. -\end{note} \indexlibraryglobal{add_sat}% \begin{itemdecl} diff --git a/source/containers.tex b/source/containers.tex index b483242c4f..9cb0ca024e 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -18837,8 +18837,12 @@ \tcode{idx < size()} is \tcode{true}. \pnum -\effects -Equivalent to: \tcode{return *(data() + idx);} +\returns +\tcode{*(data() + idx)}. + +\pnum +\throws +Nothing. \end{itemdescr} \indexlibrarymember{span}{at}% @@ -18867,8 +18871,12 @@ \tcode{empty()} is \tcode{false}. \pnum -\effects -Equivalent to: \tcode{return *data();} +\returns +\tcode{*data()}. + +\pnum +\throws +Nothing. \end{itemdescr} \indexlibrarymember{span}{back}% @@ -18882,8 +18890,12 @@ \tcode{empty()} is \tcode{false}. \pnum -\effects -Equivalent to: \tcode{return *(data() + (size() - 1));} +\returns +\tcode{*(data() + (size() - 1))}. + +\pnum +\throws +Nothing. \end{itemdescr} \indexlibrarymember{span}{data}% @@ -18893,8 +18905,8 @@ \begin{itemdescr} \pnum -\effects -Equivalent to: \tcode{return \exposid{data_};} +\returns +\exposid{data_}. \end{itemdescr} \rSec4[span.iterators]{Iterator support} diff --git a/source/future.tex b/source/future.tex index 34173964ff..bb75f49079 100644 --- a/source/future.tex +++ b/source/future.tex @@ -232,6 +232,7 @@ \indexlibraryglobal{__alignas_is_defined}% \begin{codeblock} #define @\xname{alignas_is_defined}@ 1 +#define @\xname{alignof_is_defined}@ 1 \end{codeblock} \pnum @@ -2410,6 +2411,8 @@ \begin{codeblock} codecvt codecvt +codecvt +codecvt \end{codeblock} \pnum @@ -2420,6 +2423,8 @@ \begin{codeblock} codecvt_byname codecvt_byname +codecvt_byname +codecvt_byname \end{codeblock} \pnum @@ -2427,11 +2432,13 @@ in addition to those specified in~\ref{locale.codecvt}. \indextext{UTF-8}% \indextext{UTF-16}% -The specialization \tcode{codecvt} -converts between the UTF-16 and UTF-8 encoding forms, and +The specializations \tcode{codecvt} and +\tcode{codecvt} +convert between the UTF-16 and UTF-8 encoding forms, and \indextext{UTF-32}% -the specialization \tcode{codecvt} -converts between the UTF-32 and UTF-8 encoding forms. +the specializations \tcode{codecvt} and +\tcode{codecvt} +convert between the UTF-32 and UTF-8 encoding forms. \rSec1[depr.fs.path.factory]{Deprecated filesystem path factory functions} diff --git a/source/iostreams.tex b/source/iostreams.tex index cc90aecef8..a435d3fc30 100644 --- a/source/iostreams.tex +++ b/source/iostreams.tex @@ -3513,6 +3513,11 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\expects +\range{gbeg}{gnext}, \range{gbeg}{gend}, and \range{gnext}{gend} +are all valid ranges. + \pnum \ensures \tcode{gbeg == eback()}, @@ -3573,6 +3578,10 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\expects +\range{pbeg}{pend} is a valid range. + \pnum \ensures \tcode{pbeg == pbase()}, diff --git a/source/locales.tex b/source/locales.tex index 2d6fe5ce14..26ea841200 100644 --- a/source/locales.tex +++ b/source/locales.tex @@ -320,8 +320,6 @@ collate & \tcode{collate}, \tcode{collate} \\ \rowsep ctype & \tcode{ctype}, \tcode{ctype} \\ & \tcode{codecvt} \\ - & \tcode{codecvt} \\ - & \tcode{codecvt} \\ & \tcode{codecvt} \\ \rowsep monetary & \tcode{moneypunct}, \tcode{moneypunct} \\ & \tcode{moneypunct}, \tcode{moneypunct} \\ @@ -356,8 +354,6 @@ collate & \tcode{collate_byname}, \tcode{collate_byname} \\ \rowsep ctype & \tcode{ctype_byname}, \tcode{ctype_byname} \\ & \tcode{codecvt_byname} \\ - & \tcode{codecvt_byname} \\ - & \tcode{codecvt_byname} \\ & \tcode{codecvt_byname} \\ \rowsep monetary & \tcode{moneypunct_byname} \\ & \tcode{moneypunct_byname} \\ @@ -978,18 +974,18 @@ using mask = @\seebelow@; // numeric values are for exposition only. - static const mask space = 1 << 0; - static const mask print = 1 << 1; - static const mask cntrl = 1 << 2; - static const mask upper = 1 << 3; - static const mask lower = 1 << 4; - static const mask alpha = 1 << 5; - static const mask digit = 1 << 6; - static const mask punct = 1 << 7; - static const mask xdigit = 1 << 8; - static const mask blank = 1 << 9; - static const mask alnum = alpha | digit; - static const mask graph = alnum | punct; + static constexpr mask space = 1 << 0; + static constexpr mask print = 1 << 1; + static constexpr mask cntrl = 1 << 2; + static constexpr mask upper = 1 << 3; + static constexpr mask lower = 1 << 4; + static constexpr mask alpha = 1 << 5; + static constexpr mask digit = 1 << 6; + static constexpr mask punct = 1 << 7; + static constexpr mask xdigit = 1 << 8; + static constexpr mask blank = 1 << 9; + static constexpr mask alnum = alpha | digit; + static constexpr mask graph = alnum | punct; }; } \end{codeblock} @@ -1684,13 +1680,6 @@ convert the implementation-defined native character set. \tcode{codecvt} implements a degenerate conversion; it does not convert at all. -\indextext{UTF-8}% -\indextext{UTF-16}% -\indextext{UTF-32}% -The specialization \tcode{codecvt} -converts between the UTF-16 and UTF-8 encoding forms, and -the specialization \tcode{codecvt} -converts between the UTF-32 and UTF-8 encoding forms. \tcode{codecvt} converts between the native character sets for ordinary and wide characters. Specializations on \tcode{mbstate_t} @@ -4751,6 +4740,7 @@ The set of aliases of a known registered character encoding is an \impldef{set of aliases of a known registered character encoding} superset of the aliases specified in the IANA Character Sets registry. +The set of aliases for US-ASCII includes ``ASCII''. No two aliases or primary names of distinct registered character encodings are equivalent when compared by \tcode{text_encoding::\exposid{comp-name}}. @@ -5073,6 +5063,11 @@ \tcode{ranges::range_value_t} and \tcode{ranges::range_reference_t} denote \tcode{const char*}. + +\pnum +%FIXME: Is this supposed to be a remark or a requirement? Same above? +\tcode{ranges::iterator_t} +is a constexpr iterator\iref{iterator.requirements.general}. \end{itemdescr} \rSec3[text.encoding.id]{Enumeration \tcode{text_encoding::id}} diff --git a/source/ranges.tex b/source/ranges.tex index b4af1f13d4..3cf23dcb07 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -2248,25 +2248,33 @@ \end{codeblock} \pnum -Let \exposid{container-insertable} be defined as follows: +Let \exposid{container-appendable} be defined as follows: \begin{codeblock} template -constexpr bool @\exposid{container-insertable}@ = // \expos +constexpr bool @\exposid{container-appendable}@ = // \expos requires(Container& c, Ref&& ref) { - requires (requires { c.push_back(std::forward(ref)); } || + requires (requires { c.emplace_back(std::forward(ref)); } || + requires { c.push_back(std::forward(ref)); } || + requires { c.emplace(c.end(), std::forward(ref)); } || requires { c.insert(c.end(), std::forward(ref)); }); }; \end{codeblock} \pnum -Let \exposid{container-inserter} be defined as follows: +Let \exposid{container-appendable} be defined as follows: \begin{codeblock} template -constexpr auto @\exposid{container-inserter}@(Container& c) { // \expos - if constexpr (requires { c.push_back(declval()); }) - return back_inserter(c); - else - return inserter(c, c.end()); +constexpr auto @\exposid{container-appendable}@(Container& c) { // \expos + return [&c](Ref&& ref) { + if constexpr (requires { c.emplace_back(declval()); }) + c.emplace_back(std::forward(ref)); + else if constexpr (requires { c.push_back(declval()); }) + c.push_back(std::forward(ref)); + else if constexpr (requires { c.emplace(c.end(), declval()); }) + c.emplace(c.end(), std::forward(ref)); + else + c.insert(c.end(), std::forward(ref)); + }; } \end{codeblock} @@ -2328,13 +2336,13 @@ \item \tcode{\libconcept{constructible_from}} is \tcode{true}, and \item -\tcode{\exposid{container-insertable}>} is \tcode{true}: +\tcode{\exposid{container-appendable}>} is \tcode{true}: \end{itemize} \begin{codeblock} C c(std::forward(args)...); if constexpr (@\libconcept{sized_range}@ && @\exposid{reservable-container}@) c.reserve(static_cast>(ranges::size(r))); -ranges::copy(r, @\exposid{container-inserter}@>(c)); +ranges::for_each(r, @\exposid{container-append}@(c)); \end{codeblock} \item Otherwise, the program is ill-formed. @@ -2344,7 +2352,7 @@ Otherwise, if \tcode{\libconcept{input_range}>} is \tcode{true}: \begin{codeblock} -to(r | views::transform([](auto&& elem) { +to(ref_view(r) | views::transform([](auto&& elem) { return to>(std::forward(elem)); }), std::forward(args)...); \end{codeblock} @@ -2533,6 +2541,7 @@ constexpr const T* begin() const noexcept; constexpr T* end() noexcept; constexpr const T* end() const noexcept; + static constexpr bool empty() noexcept; static constexpr size_t size() noexcept; constexpr T* data() noexcept; constexpr const T* data() const noexcept; @@ -2603,6 +2612,17 @@ Equivalent to: \tcode{return data() + 1;} \end{itemdescr} +\indexlibrarymember{empty}{single_view}% +\begin{itemdecl} +static constexpr bool empty() noexcept; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\effects +Equivalent to: \tcode{return false;} +\end{itemdescr} + \indexlibrarymember{size}{single_view}% \begin{itemdecl} static constexpr size_t size() noexcept; @@ -3406,7 +3426,7 @@ Given subexpressions \tcode{E} and \tcode{F}, the expressions \tcode{views::repeat(E)} and \tcode{views::repeat(E, F)} are expression-equivalent to -\tcode{repeat_view(E)} and \tcode{repeat_view(E, F)}, respectively. +\tcode{repeat_view>(E)} and \tcode{repeat_view(E, F)}, respectively. \pnum \begin{example} @@ -3456,8 +3476,8 @@ constexpr auto size() const requires (!@\libconcept{same_as}@); }; - template - repeat_view(T, Bound) -> repeat_view; + template + repeat_view(T, Bound = Bound()) -> repeat_view; } \end{codeblock} @@ -7909,10 +7929,9 @@ private: @\exposid{outer-iterator}@ @\exposid{i_}@ = @\exposid{outer-iterator}@(); // \expos - public: - value_type() = default; - constexpr explicit value_type(@\exposid{outer-iterator}@ i); + constexpr explicit value_type(@\exposid{outer-iterator}@ i); // \expos + public: constexpr @\exposid{inner-iterator}@ begin() const; constexpr default_sentinel_t end() const noexcept; }; @@ -8542,7 +8561,7 @@ constexpr V base() const & requires @\libconcept{copy_constructible}@ { return @\exposid{base_}@; } constexpr V base() && { return std::move(@\exposid{base_}@); } - constexpr auto begin() { + constexpr auto begin() requires (!@\exposconcept{simple-view}@) { if constexpr (@\libconcept{random_access_range}@ && @\libconcept{sized_range}@) return ranges::begin(@\exposid{base_}@); else @@ -8556,7 +8575,7 @@ return common_iterator, sentinel_t>(ranges::begin(@\exposid{base_}@)); } - constexpr auto end() { + constexpr auto end() requires (!@\exposconcept{simple-view}@) { if constexpr (@\libconcept{random_access_range}@ && @\libconcept{sized_range}@) return ranges::begin(@\exposid{base_}@) + ranges::distance(@\exposid{base_}@); else @@ -9539,13 +9558,13 @@ { return @\exposid{iterator}@(ranges::begin(@\exposid{base_}@), 0); } constexpr auto end() requires (!@\exposconcept{simple-view}@) { - if constexpr (@\libconcept{common_range}@ && @\libconcept{sized_range}@) + if constexpr (@\libconcept{forward_range}@ && @\libconcept{common_range}@ && @\libconcept{sized_range}@) return @\exposid{iterator}@(ranges::end(@\exposid{base_}@), ranges::distance(@\exposid{base_}@)); else return @\exposid{sentinel}@(ranges::end(@\exposid{base_}@)); } constexpr auto end() const requires @\exposconcept{range-with-movable-references}@ { - if constexpr (@\libconcept{common_range}@ && @\libconcept{sized_range}@) + if constexpr (@\libconcept{forward_range}@ && @\libconcept{common_range}@ && @\libconcept{sized_range}@) return @\exposid{iterator}@(ranges::end(@\exposid{base_}@), ranges::distance(@\exposid{base_}@)); else return @\exposid{sentinel}@(ranges::end(@\exposid{base_}@)); diff --git a/source/strings.tex b/source/strings.tex index 91b17d4d3b..14b11dde02 100644 --- a/source/strings.tex +++ b/source/strings.tex @@ -549,12 +549,11 @@ // \ref{string.view.comparison}, non-member comparison functions template constexpr bool operator==(basic_string_view x, - basic_string_view y) noexcept; + type_identity_t> y) noexcept; template constexpr @\seebelow@ operator<=>(basic_string_view x, - @\itcorr@ basic_string_view y) noexcept; - - // see \ref{string.view.comparison}, sufficient additional overloads of comparison functions + @\itcorr@ type_identity_t> y) noexcept; // \ref{string.view.io}, inserters and extractors template @@ -1600,47 +1599,11 @@ \rSec2[string.view.comparison]{Non-member comparison functions} -\pnum -Let \tcode{S} be \tcode{basic_string_view}, and \tcode{sv} be an instance of \tcode{S}. -Implementations shall provide sufficient additional overloads marked \keyword{constexpr} and \keyword{noexcept} -so that an object \tcode{t} with an implicit conversion to \tcode{S} can be compared according to \tref{string.view.comparison.overloads}. -\begin{libtab2}{Additional \tcode{basic_string_view} comparison overloads}{string.view.comparison.overloads}{cc}{Expression}{Equivalent to} -\tcode{t == sv} & \tcode{S(t) == sv} \\ -\tcode{sv == t} & \tcode{sv == S(t)} \\ -\tcode{t != sv} & \tcode{S(t) != sv} \\ -\tcode{sv != t} & \tcode{sv != S(t)} \\ -\tcode{t < sv} & \tcode{S(t) < sv} \\ -\tcode{sv < t} & \tcode{sv < S(t)} \\ -\tcode{t > sv} & \tcode{S(t) > sv} \\ -\tcode{sv > t} & \tcode{sv > S(t)} \\ -\tcode{t <= sv} & \tcode{S(t) <= sv} \\ -\tcode{sv <= t} & \tcode{sv <= S(t)} \\ -\tcode{t >= sv} & \tcode{S(t) >= sv} \\ -\tcode{sv >= t} & \tcode{sv >= S(t)} \\ -\tcode{t <=> sv} & \tcode{S(t) <=> sv} \\ -\tcode{sv <=> t} & \tcode{sv <=> S(t)} \\ -\end{libtab2} -\begin{example} -A sample conforming implementation for \tcode{operator==} would be: -\begin{codeblock} -template - constexpr bool operator==(basic_string_view lhs, - basic_string_view rhs) noexcept { - return lhs.compare(rhs) == 0; - } -template - constexpr bool operator==(basic_string_view lhs, - type_identity_t> rhs) noexcept { - return lhs.compare(rhs) == 0; - } -\end{codeblock} -\end{example} - \indexlibrarymember{operator==}{basic_string_view}% \begin{itemdecl} template constexpr bool operator==(basic_string_view lhs, - basic_string_view rhs) noexcept; + type_identity_t> rhs) noexcept; \end{itemdecl} \begin{itemdescr} @@ -1653,7 +1616,7 @@ \begin{itemdecl} template constexpr @\seebelow@ operator<=>(basic_string_view lhs, - @\itcorr@ basic_string_view rhs) noexcept; + @\itcorr@ type_identity_t> rhs) noexcept; \end{itemdecl} \begin{itemdescr} @@ -1669,6 +1632,15 @@ \pnum \returns \tcode{static_cast(lhs.compare(rhs) <=> 0)}. + +\pnum +\begin{note} +The usage of \tcode{type_identity_t} as parameter +ensures that an object of type \tcode{basic_string_view} +can always be compared with an object of a type \tcode{T} with +an implicit conversion to \tcode{basic_string_view}, and +vice versa, as per \ref{over.match.oper}. +\end{note} \end{itemdescr} \rSec2[string.view.io]{Inserters and extractors} diff --git a/source/utilities.tex b/source/utilities.tex index 35e07e03ae..5c3845bb42 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -2049,6 +2049,12 @@ \begin{codeblock} !(is_convertible_v(std::forward(u))), Types> && ...) \end{codeblock} +The constructor is defined as deleted if +\begin{codeblock} +(reference_constructs_from_temporary_v(std::forward(u)))> + || ...) +\end{codeblock} +is \tcode{true}. \end{itemdescr} \indexlibraryctor{tuple}% @@ -7305,10 +7311,10 @@ class bad_expected_access : public exception { protected: bad_expected_access() noexcept; - bad_expected_access(const bad_expected_access&); - bad_expected_access(bad_expected_access&&); - bad_expected_access& operator=(const bad_expected_access&); - bad_expected_access& operator=(bad_expected_access&&); + bad_expected_access(const bad_expected_access&) noexcept; + bad_expected_access(bad_expected_access&&) noexcept; + bad_expected_access& operator=(const bad_expected_access& noexcept); + bad_expected_access& operator=(bad_expected_access&&) noexcept; ~bad_expected_access(); public: @@ -9126,6 +9132,11 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +\tcode{is_move_constructible_v} is \tcode{true} and +\tcode{is_move_assignable_v} is \tcode{true}. + \pnum \effects \begin{itemize} @@ -9152,11 +9163,6 @@ \remarks The exception specification is equivalent to \tcode{is_nothrow_move_constructible_v \&\& is_nothrow_move_assignable_v}. - -\pnum -This operator is defined as deleted unless -\tcode{is_move_constructible_v} is \tcode{true} and -\tcode{is_move_assignable_v} is \tcode{true}. \end{itemdescr} \indexlibrarymember{operator=}{expected}% @@ -17276,6 +17282,11 @@ the format string range being parsed and the argument counter for automatic indexing. +\pnum +If a program declares an explicit or partial specialization of +\tcode{basic_format_parse_context}, +the program is ill-formed, no diagnostic required. + \indexlibraryctor{basic_format_parse_context}% \begin{itemdecl} constexpr explicit basic_format_parse_context(basic_string_view fmt) noexcept; @@ -17487,6 +17498,11 @@ An instance of \tcode{basic_format_context} holds formatting state consisting of the formatting arguments and the output iterator. +\pnum +If a program declares an explicit or partial specialization of +\tcode{basic_format_context}, +the program is ill-formed, no diagnostic required. + \pnum \tcode{Out} shall model \tcode{\libconcept{output_iterator}}.