diff --git a/source/algorithms.tex b/source/algorithms.tex index 986afa033f..950f542ffa 100644 --- a/source/algorithms.tex +++ b/source/algorithms.tex @@ -2846,7 +2846,7 @@ lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1, InputIterator2 b2, InputIterator2 e2, Cmp comp) - -> common_comparison_category_t; + -> decltype(comp(*b1, *b2)); template constexpr auto lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1, @@ -8444,7 +8444,7 @@ lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1, InputIterator2 b2, InputIterator2 e2, Cmp comp) - -> common_comparison_category_t; + -> decltype(comp(*b1, *b2)); \end{itemdecl} \begin{itemdescr} diff --git a/source/back.tex b/source/back.tex index 511d3f9a26..33c925ab46 100644 --- a/source/back.tex +++ b/source/back.tex @@ -6,6 +6,9 @@ \chapter{Bibliography} \begin{itemize} \renewcommand{\labelitemi}{---} +\item + IANA Time Zone Database, + available at \url{https://www.iana.org/time-zones} \item ISO/IEC 10967-1:2012, \doccite{Information technology --- Language independent arithmetic --- diff --git a/source/concepts.tex b/source/concepts.tex index 814db1e127..8ec984eb9d 100644 --- a/source/concepts.tex +++ b/source/concepts.tex @@ -200,9 +200,9 @@ template concept constructible_from = @\seebelow@; - // \ref{concept.defaultconstructible}, concept \libconcept{default_constructible} + // \ref{concept.default.init}, concept \libconcept{default_initializable} template - concept default_constructible = @\seebelow@; + concept default_initializable = @\seebelow@; // \ref{concept.moveconstructible}, concept \libconcept{move_constructible} template @@ -314,29 +314,33 @@ \rSec2[concept.convertible]{Concept \cname{convertible_to}} \pnum -The \libconcept{convertible_to} concept requires an expression of a particular -type and value category to be both implicitly and explicitly convertible to some -other type. The implicit and explicit conversions are required to produce equal +Given types \tcode{From} and \tcode{To} and +an expression \tcode{E} such that +\tcode{decltype((E))} is \tcode{add_rvalue_reference_t}, +\tcode{\libconcept{convertible_to}} requires \tcode{E} +to be both implicitly and explicitly convertible to type \tcode{To}. +The implicit and explicit conversions are required to produce equal results. \begin{itemdecl} template concept @\deflibconcept{convertible_to}@ = is_convertible_v && - requires(From (&f)()) { + requires(add_rvalue_reference_t (&f)()) { static_cast(f()); }; \end{itemdecl} \begin{itemdescr} \pnum -Let \tcode{test} be the invented function: +Let \tcode{FromR} be \tcode{add_rvalue_reference_t} and +\tcode{test} be the invented function: \begin{codeblock} -To test(From (&f)()) { +To test(FromR (&f)()) { return f(); } \end{codeblock} -and let \tcode{f} be a function with no arguments and return type \tcode{From} +and let \tcode{f} be a function with no arguments and return type \tcode{FromR} such that \tcode{f()} is equality-preserving. Types \tcode{From} and \tcode{To} model \tcode{\libconcept{convertible_to}} only if: @@ -347,11 +351,11 @@ \tcode{static_cast(f())} is equal to \tcode{test(f)}. \item -\tcode{From} is not a reference-to-object type, or +\tcode{FromR} is not a reference-to-object type, or \begin{itemize} \item -If \tcode{From} is an rvalue reference to a non const-qualified type, the +If \tcode{FromR} is an rvalue reference to a non const-qualified type, the resulting state of the object referenced by \tcode{f()} after either above expression is valid but unspecified\iref{lib.types.movedfrom}. @@ -735,14 +739,14 @@ concept @\deflibconcept{constructible_from}@ = destructible && is_constructible_v; \end{itemdecl} -\rSec2[concept.defaultconstructible]{Concept \cname{default_constructible}} +\rSec2[concept.default.init]{Concept \cname{default_initializable}} \begin{itemdecl} template inline constexpr bool @\defexposconcept{is-default-initializable}@ = @\seebelow@; // \expos template - concept @\deflibconcept{default_constructible}@ = constructible_from && + concept @\deflibconcept{default_initializable}@ = constructible_from && requires { T{}; } && @\exposconcept{is-default-initializable}@; \end{itemdecl} @@ -957,14 +961,7 @@ \begin{itemdecl} template concept @\deflibconcept{totally_ordered}@ = - equality_comparable && - requires(const remove_reference_t& a, - const remove_reference_t& b) { - { a < b } -> boolean; - { a > b } -> boolean; - { a <= b } -> boolean; - { a >= b } -> boolean; - }; + equality_comparable && @\exposconcept{partially-ordered-with}@; \end{itemdecl} \begin{itemdescr} @@ -978,7 +975,6 @@ \tcode{bool(a == b)} is \tcode{true}. \item If \tcode{bool(a < b)} and \tcode{bool(b < c)}, then \tcode{bool(a < c)}. -\item \tcode{bool(a > b) == bool(b < a)}. \item \tcode{bool(a <= b) == !bool(b < a)}. \item \tcode{bool(a >= b) == !bool(a < b)}. \end{itemize} @@ -989,23 +985,12 @@ template concept @\deflibconcept{totally_ordered_with}@ = totally_ordered && totally_ordered && - common_reference_with&, const remove_reference_t&> && + equality_comparable_with && totally_ordered< common_reference_t< const remove_reference_t&, const remove_reference_t&>> && - equality_comparable_with && - requires(const remove_reference_t& t, - const remove_reference_t& u) { - { t < u } -> boolean; - { t > u } -> boolean; - { t <= u } -> boolean; - { t >= u } -> boolean; - { u < t } -> boolean; - { u > t } -> boolean; - { u <= t } -> boolean; - { u >= t } -> boolean; - }; + @\exposconcept{partially-ordered-with}@; \end{itemdecl} \begin{itemdescr} @@ -1045,7 +1030,7 @@ template concept @\deflibconcept{copyable}@ = copy_constructible && movable && assignable_from; template - concept @\deflibconcept{semiregular}@ = copyable && default_constructible; + concept @\deflibconcept{semiregular}@ = copyable && default_initializable; template concept @\deflibconcept{regular}@ = semiregular && equality_comparable; \end{itemdecl} diff --git a/source/containers.tex b/source/containers.tex index 6289fbd4cb..f19d29aaff 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -3114,7 +3114,8 @@ \indexheader{array}% \begin{codeblock} -#include +#include // see \ref{compare.syn} +#include // see \ref{initializer.list.syn} namespace std { // \ref{array}, class template \tcode{array} @@ -3151,7 +3152,8 @@ \indexheader{deque}% \begin{codeblock} -#include +#include // see \ref{compare.syn} +#include // see \ref{initializer.list.syn} namespace std { // \ref{deque}, class template \tcode{deque} @@ -3183,7 +3185,8 @@ \indexheader{forward_list}% \begin{codeblock} -#include +#include // see \ref{compare.syn} +#include // see \ref{initializer.list.syn} namespace std { // \ref{forwardlist}, class template \tcode{forward_list} @@ -3215,7 +3218,8 @@ \indexheader{list}% \begin{codeblock} -#include +#include // see \ref{compare.syn} +#include // see \ref{initializer.list.syn} namespace std { // \ref{list}, class template \tcode{list} @@ -3247,7 +3251,8 @@ \indexheader{vector}% \begin{codeblock} -#include +#include // see \ref{compare.syn} +#include // see \ref{initializer.list.syn} namespace std { // \ref{vector}, class template \tcode{vector} @@ -6249,7 +6254,8 @@ \indexheader{map}% \begin{codeblock} -#include +#include // see \ref{compare.syn} +#include // see \ref{initializer.list.syn} namespace std { // \ref{map}, class template \tcode{map} @@ -6310,7 +6316,8 @@ \indexheader{set}% \begin{codeblock} -#include +#include // see \ref{compare.syn} +#include // see \ref{initializer.list.syn} namespace std { // \ref{set}, class template \tcode{set} @@ -7805,7 +7812,8 @@ \indexlibraryglobal{unordered_map}% \indexlibraryglobal{unordered_multimap}% \begin{codeblock} -#include +#include // see \ref{compare.syn} +#include // see \ref{initializer.list.syn} namespace std { // \ref{unord.map}, class template \tcode{unordered_map} @@ -7874,7 +7882,8 @@ \indexlibraryglobal{unordered_set}% \indexlibraryglobal{unordered_multiset}% \begin{codeblock} -#include +#include // see \ref{compare.syn} +#include // see \ref{initializer.list.syn} namespace std { // \ref{unord.set}, class template \tcode{unordered_set} @@ -9587,7 +9596,8 @@ \indexheader{queue} \begin{codeblock} -#include +#include // see \ref{compare.syn} +#include // see \ref{initializer.list.syn} namespace std { template> class queue; @@ -9629,7 +9639,8 @@ \indexheader{stack}% \begin{codeblock} -#include +#include // see \ref{compare.syn} +#include // see \ref{initializer.list.syn} namespace std { template> class stack; @@ -10514,6 +10525,9 @@ template class span; + template + inline constexpr bool ranges::enable_view> = + Extent == 0 || Extent == dynamic_extent; template inline constexpr bool ranges::enable_safe_range> = true; @@ -10568,9 +10582,7 @@ using reference = element_type&; using const_reference = const element_type&; using iterator = @\impdefx{type of \tcode{span::iterator}}@; // see \ref{span.iterators} - using const_iterator = @\impdefx{type of \tcode{span::const_iterator}}@; using reverse_iterator = std::reverse_iterator; - using const_reverse_iterator = std::reverse_iterator; static constexpr size_type extent = Extent; // \ref{span.cons}, constructors, copy, and assignment @@ -10622,12 +10634,8 @@ // \ref{span.iterators}, iterator support constexpr iterator begin() const noexcept; constexpr iterator end() const noexcept; - constexpr const_iterator cbegin() const noexcept; - constexpr const_iterator cend() const noexcept; constexpr reverse_iterator rbegin() const noexcept; constexpr reverse_iterator rend() const noexcept; - constexpr const_reverse_iterator crbegin() const noexcept; - constexpr const_reverse_iterator crend() const noexcept; private: pointer data_; // \expos @@ -11119,23 +11127,21 @@ \rSec3[span.iterators]{Iterator support} \indexlibrarymember{iterator}{span}% -\indexlibrarymember{const_iterator}{span}% \begin{itemdecl} using iterator = @\impdefx{type of \tcode{span::iterator}}@; -using const_iterator = @\impdefx{type of \tcode{span::const_iterator}}@; \end{itemdecl} \begin{itemdescr} \pnum -The types -model \libconcept{contiguous_iterator}\iref{iterator.concept.contiguous}, -meet the \oldconcept{RandomAccessIterator} +The type +models \libconcept{contiguous_iterator}\iref{iterator.concept.contiguous}, +meets the \oldconcept{RandomAccessIterator} requirements\iref{random.access.iterators}, and -meet the requirements for +meets the requirements for constexpr iterators\iref{iterator.requirements.general}. All requirements on container iterators\iref{container.requirements} apply to -\tcode{span::iterator} and \tcode{span::const_iterator} as well. +\tcode{span::iterator} as well. \end{itemdescr} \indexlibrarymember{span}{begin}% @@ -11184,52 +11190,6 @@ Equivalent to: \tcode{return reverse_iterator(begin());} \end{itemdescr} -\indexlibrarymember{span}{cbegin}% -\begin{itemdecl} -constexpr const_iterator cbegin() const noexcept; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\returns -A constant iterator referring to the first element in the span. -If \tcode{empty()} is \tcode{true}, then it returns the same value -as \tcode{cend()}. -\end{itemdescr} - -\indexlibrarymember{span}{cend}% -\begin{itemdecl} -constexpr const_iterator cend() const noexcept; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\returns -A constant iterator which is the past-the-end value. -\end{itemdescr} - -\indexlibrarymember{span}{crbegin}% -\begin{itemdecl} -constexpr const_reverse_iterator crbegin() const noexcept; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\effects -Equivalent to: \tcode{return const_reverse_iterator(cend());} -\end{itemdescr} - -\indexlibrarymember{span}{crend}% -\begin{itemdecl} -constexpr const_reverse_iterator crend() const noexcept; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\effects -Equivalent to: \tcode{return const_reverse_iterator(cbegin());} -\end{itemdescr} - \rSec3[span.objectrep]{Views of object representation} diff --git a/source/diagnostics.tex b/source/diagnostics.tex index d7267f9e48..e32db0f167 100644 --- a/source/diagnostics.tex +++ b/source/diagnostics.tex @@ -680,6 +680,8 @@ \indexlibraryglobal{is_error_condition_enum}% \indexlibraryglobal{errc}% \begin{codeblock} +#include // see \ref{compare.syn} + namespace std { class error_category; const error_category& generic_category() noexcept; diff --git a/source/intro.tex b/source/intro.tex index b0bdd7f467..ab5ff09bd4 100644 --- a/source/intro.tex +++ b/source/intro.tex @@ -35,14 +35,10 @@ \begin{itemize} \item Ecma International, \doccite{ECMAScript Language Specification}, Standard Ecma-262, third edition, 1999. +% FIXME: Is the following comment refering to the entry above or +% the entry removed in LWG3319? I.e. is it still valid? %%% Format for this entry is based on that specified at %%% http://www.iec.ch/standardsdev/resources/draftingpublications/directives/principles/referencing.htm -\item INTERNET ENGINEERING TASK FORCE (IETF). RFC 6557: -Procedures for Maintaining the Time Zone Database [online]. -Edited by E. Lear, P. Eggert. -February 2012 [viewed 2018-03-26]. -Available at -\url{https://www.ietf.org/rfc/rfc6557.txt} \item ISO/IEC 2382 (all parts), \doccite{Information technology --- Vocabulary} \item ISO 8601:2004, \doccite{Data elements and interchange formats --- diff --git a/source/iostreams.tex b/source/iostreams.tex index e1c601e6b5..131afb7c7b 100644 --- a/source/iostreams.tex +++ b/source/iostreams.tex @@ -11438,6 +11438,8 @@ \indexheader{filesystem}% \begin{codeblock} +#include // see \ref{compare.syn} + namespace std::filesystem { // \ref{fs.class.path}, paths class path; diff --git a/source/iterators.tex b/source/iterators.tex index 7544e12f2d..d2739af41e 100644 --- a/source/iterators.tex +++ b/source/iterators.tex @@ -33,7 +33,8 @@ \indexlibraryglobal{default_sentinel}% \indexlibraryglobal{unreachable_sentinel}% \begin{codeblock} -#include +#include // see \ref{compare.syn} +#include // see \ref{concepts.syn} namespace std { template using @\placeholder{with-reference}@ = T&; // \expos @@ -1055,7 +1056,9 @@ expression-equivalent to: \begin{itemize} -\item \tcode{iter_move(E)}, if that expression is valid, with overload +\item \tcode{iter_move(E)}, if +\tcode{E} has class or enumeration type and +\tcode{iter_move(E)} is a well-formed expression with overload resolution performed in a context that does not include a declaration of \tcode{ranges::iter_move}. @@ -1110,7 +1113,9 @@ The expression \tcode{ranges::iter_swap(E1, E2)} for subexpressions \tcode{E1} and \tcode{E2} is expression-equivalent to: \begin{itemize} -\item \tcode{(void)iter_swap(E1, E2)}, if that expression is valid, +\item \tcode{(void)iter_swap(E1, E2)}, if either +\tcode{E1} or \tcode{E2} has class or enumeration type and +\tcode{iter_swap(E1, E2)} is a well-formed expression with overload resolution performed in a context that includes the declaration \begin{codeblock} template @@ -1294,7 +1299,7 @@ template concept @\deflibconcept{weakly_incrementable}@ = - default_constructible && movable && + default_initializable && movable && requires(I i) { typename iter_difference_t; requires @\placeholdernc{is-signed-integer-like}@>; @@ -1791,7 +1796,7 @@ \item \tcode{(a + D(0))} is equal to \tcode{a}. \item If \tcode{(a + D(n - 1))} is valid, then \tcode{(a + n)} is equal to \tcode{[](I c)\{ return ++c; \}(a + D(n - 1))}. -\item \tcode{(b += -n)} is equal to \tcode{a}. +\item \tcode{(b += D(-n))} is equal to \tcode{a}. \item \tcode{(b -= n)} is equal to \tcode{a}. \item \tcode{addressof(b -= n)} is equal to \tcode{addressof(b)}. \item \tcode{(b - n)} is equal to \tcode{(b -= n)}. @@ -6610,9 +6615,10 @@ \end{itemdecl} \begin{itemdescr} \pnum -\returns +\effects +Equivalent to: \begin{codeblock} -static_cast>>(c.size()) +return static_cast>>(c.size()); \end{codeblock} \end{itemdescr} diff --git a/source/lib-intro.tex b/source/lib-intro.tex index 5d82395496..c802b2b1fb 100644 --- a/source/lib-intro.tex +++ b/source/lib-intro.tex @@ -1026,7 +1026,7 @@ enforcing semantic requirements on that interaction. \pnum -The type of a customization point object shall model +The type of a customization point object, ignoring cv-qualifiers, shall model \libconcept{semiregular}\iref{concepts.object}. \pnum @@ -2200,12 +2200,12 @@ (not used) & \effects Constructs an object of type \tcode{C} at \tcode{c} & - \tcode{::new ((void*)c) C(forward<\brk{}Args>\brk(args)...)} \\ \rowsep + \tcode{construct_at(c,~std::\brk{}forward\brk{}(args)...)} \\ \rowsep \tcode{a.destroy(c)} & (not used) & \effects Destroys the object at \tcode{c} & - \tcode{c->\~{}C()} \\ \rowsep + \tcode{destroy_at(c)} \\ \rowsep \tcode{a.select_on_container_copy_construction()} & \tcode{X} & diff --git a/source/ranges.tex b/source/ranges.tex index e33004d33d..3d34a50710 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -25,8 +25,9 @@ \indexheader{ranges}% \begin{codeblock} -#include -#include +#include // see \ref{compare.syn} +#include // see \ref{initializer.list.syn} +#include // see \ref{iterator.synopsis} namespace std::ranges { inline namespace @\unspec@ { @@ -50,7 +51,7 @@ template concept range = @\seebelow@; - template + template inline constexpr bool enable_safe_range = false; template @@ -278,8 +279,8 @@ namespace views { template inline constexpr @\unspec@ elements = @\unspec@ ; - inline constexpr @\unspec@ keys = @\unspec@ ; - inline constexpr @\unspec@ values = @\unspec@ ; + inline constexpr auto keys = elements<0>; + inline constexpr auto values = elements<1>; } } @@ -899,7 +900,6 @@ template concept @\deflibconcept{sized_range}@ = range && - !disable_sized_range> && requires(T& t) { ranges::size(t); }; \end{itemdecl} @@ -966,7 +966,7 @@ \begin{itemdecl} template concept @\deflibconcept{view}@ = - range && movable && default_constructible && enable_view; + range && movable && default_initializable && enable_view; \end{itemdecl} \begin{itemdescr} @@ -1016,35 +1016,12 @@ \indexlibraryglobal{enable_view}% \begin{itemdecl} template - inline constexpr bool enable_view = @\seebelow@; + inline constexpr bool enable_view = derived_from; \end{itemdecl} \begin{itemdescr} \pnum \remarks -For a type \tcode{T}, the default value of \tcode{enable_view} is: -\begin{itemize} - -\item If \tcode{derived_from} is \tcode{true}, \tcode{true}. -\item Otherwise, if \tcode{T} is a specialization of class template - \tcode{initializer_list}\iref{support.initlist}, - \tcode{set}\iref{set}, - \tcode{multiset}\iref{multiset}, - \tcode{unordered_set}\iref{unord.set}, - \tcode{unordered_multiset}\iref{unord.multiset}, or - \tcode{match_results}\iref{re.results}, \tcode{false}. -\item Otherwise, if both \tcode{T} and \tcode{const T} model \libconcept{range} - and \tcode{range_reference_t} is not the same type as - \tcode{range_reference_t}, - \tcode{false}. - \begin{note} - Deep \tcode{const}-ness implies element ownership, - whereas shallow \tcode{const}-ness implies reference semantics. - \end{note} -\item Otherwise, \tcode{true}. -\end{itemize} - -\pnum Pursuant to \ref{namespace.std}, users may specialize \tcode{enable_view} to \tcode{true} for cv-unqualified program-defined types which model \libconcept{view}, @@ -1465,7 +1442,7 @@ Equivalent to: \begin{itemize} \item If \exposid{StoreSize} is \tcode{true}, -\tcode{subrange\{ranges::begin(r), ranges::end(r), ranges::size(r)\}}. +\tcode{subrange\{r, ranges::size(r)\}}. \item Otherwise, \tcode{subrange\{ranges::begin(r), ranges::end(r)\}}. \end{itemize} \end{itemdescr} @@ -1901,7 +1878,7 @@ @\seebelow@; template - requires @\exposconcept{weakly-equality-comparable-with}@ + requires @\exposconcept{weakly-equality-comparable-with}@ && semiregular class iota_view : public view_interface> { private: // \ref{range.iota.iterator}, class \tcode{iota_view::\exposid{iterator}} @@ -2140,7 +2117,8 @@ private: W @\exposid{value_}@ = W(); // \expos public: - using iterator_category = @\seebelow@; + using iterator_concept = @\seebelow@; + using iterator_category = input_iterator_tag; using value_type = W; using difference_type = @\placeholdernc{IOTA-DIFF-T}@(W); @@ -2192,15 +2170,15 @@ \end{codeblock} \pnum -\tcode{iterator::iterator_category} is defined as follows: +\tcode{\exposid{iterator}::iterator_concept} is defined as follows: \begin{itemize} \item If \tcode{W} models \tcode{\placeholder{advanceable}}, then -\tcode{iterator_category} is \tcode{random_access_iterator_tag}. +\tcode{iterator_concept} is \tcode{random_access_iterator_tag}. \item Otherwise, if \tcode{W} models \exposconcept{decrementable}, then -\tcode{iterator_category} is \tcode{bidirectional_iterator_tag}. +\tcode{iterator_concept} is \tcode{bidirectional_iterator_tag}. \item Otherwise, if \tcode{W} models \libconcept{incrementable}, then -\tcode{iterator_category} is \tcode{forward_iterator_tag}. -\item Otherwise, \tcode{iterator_category} is \tcode{input_iterator_tag}. +\tcode{iterator_concept} is \tcode{forward_iterator_tag}. +\item Otherwise, \tcode{iterator_concept} is \tcode{input_iterator_tag}. \end{itemize} \pnum @@ -2598,7 +2576,7 @@ }; template - requires default_constructible && + requires default_initializable && @\exposconcept{stream-extractable}@ class basic_istream_view : public view_interface> { public: @@ -2849,7 +2827,7 @@ its type parameter \tcode{T} with \tcode{\libconcept{copy_constructible} \&\& is_object_v}. -\item If \tcode{T} models \libconcept{default_constructible}, the default +\item If \tcode{T} models \libconcept{default_initializable}, the default constructor of \tcode{\placeholder{semiregular-box}} is equivalent to: \begin{codeblock} constexpr @\placeholder{semiregular-box}@() noexcept(is_nothrow_default_constructible_v) @@ -3015,9 +2993,6 @@ public: filter_view() = default; constexpr filter_view(V base, Pred pred); - template - requires viewable_range && constructible_from> - constexpr filter_view(R&& r, Pred pred); constexpr V base() const& requires copy_constructible { return @\exposid{base_}@; } constexpr V base() && { return std::move(@\exposid{base_}@); } @@ -3048,20 +3023,6 @@ \exposid{pred_} with \tcode{std::move(pred)}. \end{itemdescr} -\indexlibraryctor{filter_view}% -\begin{itemdecl} -template - requires viewable_range && constructible_from> -constexpr filter_view(R&& r, Pred pred); -\end{itemdecl} - -\begin{itemdescr} -\pnum -\effects -Initializes \exposid{base_} with \tcode{views::all(std::forward(r))} -and initializes \exposid{pred_} with \tcode{std::\brk{}move(pred)}. -\end{itemdescr} - \indexlibrarymember{begin}{filter_view}% \begin{itemdecl} constexpr @\exposid{iterator}@ begin(); @@ -3423,7 +3384,8 @@ namespace std::ranges { template requires view && is_object_v && - regular_invocable> + regular_invocable> && + @\exposconcept{can-reference}@>> class transform_view : public view_interface> { private: // \ref{range.transform.iterator}, class template \tcode{transform_view::\exposid{iterator}} @@ -3437,9 +3399,6 @@ public: transform_view() = default; constexpr transform_view(V base, F fun); - template - requires viewable_range && constructible_from> - constexpr transform_view(R&& r, F fun); constexpr V base() const& requires copy_constructible { return @\exposid{base_}@; } constexpr V base() && { return std::move(@\exposid{base_}@); } @@ -3480,20 +3439,6 @@ \exposid{fun_} with \tcode{std::move(fun)}. \end{itemdescr} -\indexlibraryctor{transform_view}% -\begin{itemdecl} -template - requires viewable_range && constructible_from> -constexpr transform_view(R&& r, F fun); -\end{itemdecl} - -\begin{itemdescr} -\pnum -\effects -Initializes \exposid{base_} with \tcode{views::all(std::forward(r))} -and \exposid{fun_} with \tcode{std::move(fun)}. -\end{itemdescr} - \indexlibrarymember{begin}{transform_view}% \begin{itemdecl} constexpr @\exposid{iterator}@ begin(); @@ -4124,9 +4069,6 @@ public: take_view() = default; constexpr take_view(V base, range_difference_t count); - template - requires constructible_from> - constexpr take_view(R&& r, range_difference_t count); constexpr V base() const& requires copy_constructible { return @\exposid{base_}@; } constexpr V base() && { return std::move(@\exposid{base_}@); } @@ -4135,8 +4077,10 @@ if constexpr (sized_range) { if constexpr (random_access_range) return ranges::begin(@\exposid{base_}@); - else - return counted_iterator{ranges::begin(@\exposid{base_}@), size()}; + else { + auto sz = size(); + return counted_iterator{ranges::begin(@\exposid{base_}@), sz}; + } } else return counted_iterator{ranges::begin(@\exposid{base_}@), @\exposid{count_}@}; } @@ -4145,8 +4089,10 @@ if constexpr (sized_range) { if constexpr (random_access_range) return ranges::begin(@\exposid{base_}@); - else - return counted_iterator{ranges::begin(@\exposid{base_}@), size()}; + else { + auto sz = size(); + return counted_iterator{ranges::begin(@\exposid{base_}@), sz}; + } } else return counted_iterator{ranges::begin(@\exposid{base_}@), @\exposid{count_}@}; } @@ -4200,20 +4146,6 @@ \exposid{count_} with \tcode{count}. \end{itemdescr} -\indexlibraryctor{take_view}% -\begin{itemdecl} -template - requires constructible_from> -constexpr take_view(R&& r, range_difference_t count); -\end{itemdecl} - -\begin{itemdescr} -\pnum -\effects -Initializes \exposid{base_} with \tcode{views::all(std::forward(r))} -and \exposid{count_} with \tcode{count}. -\end{itemdescr} - \rSec3[range.take.sentinel]{Class template \tcode{take_view::\exposid{sentinel}}} \indexlibraryglobal{take_view::sentinel}% @@ -4736,10 +4668,6 @@ join_view() = default; constexpr explicit join_view(V base); - template - requires viewable_range && constructible_from> - constexpr explicit join_view(R&& r); - constexpr V base() const& requires copy_constructible { return @\exposid{base_}@; } constexpr V base() && { return std::move(@\exposid{base_}@); } @@ -4792,19 +4720,6 @@ Initializes \exposid{base_} with \tcode{std::move(base)}. \end{itemdescr} -\indexlibraryctor{join_view}% -\begin{itemdecl} -template - requires viewable_range && constructible_from> -constexpr explicit join_view(R&& r); -\end{itemdecl} - -\begin{itemdescr} -\pnum -\effects -Initializes \exposid{base_} with \tcode{views::all(std::forward(r))}. -\end{itemdescr} - \rSec3[range.join.iterator]{Class template \tcode{join_view::\exposid{iterator}}} \indexlibraryglobal{join_view::iterator}% @@ -4854,11 +4769,13 @@ constexpr @\exposid{iterator}@& operator--() requires @\exposid{ref-is-glvalue}@ && bidirectional_range<@\exposid{Base}@> && - bidirectional_range>; + bidirectional_range> && + common_range>; constexpr @\exposid{iterator}@ operator--(int) requires @\exposid{ref-is-glvalue}@ && bidirectional_range<@\exposid{Base}@> && - bidirectional_range>; + bidirectional_range> && + common_range>; friend constexpr bool operator==(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\exposid{ref-is-glvalue}@ && equality_comparable> && @@ -5049,7 +4966,8 @@ \begin{itemdecl} constexpr @\exposid{iterator}@& operator--() requires @\exposid{ref-is-glvalue}@ && bidirectional_range<@\exposid{Base}@> && - bidirectional_range>; + bidirectional_range> && + common_range>; \end{itemdecl} \begin{itemdescr} @@ -5070,7 +4988,8 @@ \begin{itemdecl} constexpr @\exposid{iterator}@ operator--(int) requires @\exposid{ref-is-glvalue}@ && bidirectional_range<@\exposid{Base}@> && - bidirectional_range>; + bidirectional_range> && + common_range>; \end{itemdecl} \begin{itemdescr} @@ -5233,11 +5152,6 @@ split_view() = default; constexpr split_view(V base, Pattern pattern); - template - requires constructible_from> && - constructible_from> - constexpr split_view(R&& r, P&& p); - template requires constructible_from> && constructible_from>> @@ -5292,21 +5206,6 @@ \exposid{pattern_} with \tcode{std::move(pattern)}. \end{itemdescr} -\indexlibraryctor{split_view}% -\begin{itemdecl} -template - requires constructible_from> && - constructible_from> -constexpr split_view(R&& r, P&& p); -\end{itemdecl} - -\begin{itemdescr} -\pnum -\effects -Initializes \exposid{base_} with \tcode{views::all(std::forward(r))}, and -\exposid{pattern_} with \tcode{views::all(\brk{}std::forward

(p))}. -\end{itemdescr} - \indexlibraryctor{split_view}% \begin{itemdecl} template @@ -5928,10 +5827,6 @@ constexpr explicit reverse_view(V r); - template - requires bidirectional_range && constructible_from> - constexpr explicit reverse_view(R&& r); - constexpr V base() const& requires copy_constructible { return @\exposid{base_}@; } constexpr V base() && { return std::move(@\exposid{base_}@); } @@ -5968,19 +5863,6 @@ Initializes \exposid{base_} with \tcode{std::move(base)}. \end{itemdescr} -\indexlibraryctor{reverse_view}% -\begin{itemdecl} -template - requires bidirectional_range && constructible_from> -constexpr explicit reverse_view(R&& r); -\end{itemdecl} - -\begin{itemdescr} -\pnum -\effects -Initializes \exposid{base_} with \tcode{views::all(std::forward(r))}. -\end{itemdescr} - \indexlibrarymember{begin}{reverse_view}% \begin{itemdecl} constexpr reverse_iterator> begin(); @@ -6103,7 +5985,7 @@ typename tuple_size::type; requires N < tuple_size_v; typename tuple_element_t; - { get(t) } -> const tuple_element_t&; + { get(t) } -> convertible_to&>; }; diff --git a/source/regex.tex b/source/regex.tex index 97ef35bb0e..007e8bc69f 100644 --- a/source/regex.tex +++ b/source/regex.tex @@ -265,7 +265,8 @@ \indexlibraryglobal{regex}% \indexlibraryglobal{wregex}% \begin{codeblock} -#include +#include // see \ref{compare.syn} +#include // see \ref{initializer.list.syn} namespace std { // \ref{re.const}, regex constants @@ -1296,7 +1297,7 @@ basic_regex& assign(const basic_regex& e); basic_regex& assign(basic_regex&& e) noexcept; basic_regex& assign(const charT* p, flag_type f = regex_constants::ECMAScript); - basic_regex& assign(const charT* p, size_t len, flag_type f); + basic_regex& assign(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript); template basic_regex& assign(const basic_string& s, flag_type f = regex_constants::ECMAScript); diff --git a/source/strings.tex b/source/strings.tex index d5f1f22094..d2f212c5d2 100644 --- a/source/strings.tex +++ b/source/strings.tex @@ -528,7 +528,8 @@ \indexheader{string}% \begin{codeblock} -#include +#include // see \ref{compare.syn} +#include // see \ref{initializer.list.syn} namespace std { // \ref{char.traits}, character traits @@ -3927,11 +3928,15 @@ \indexheader{string_view}% \begin{codeblock} +#include // see \ref{compare.syn} + namespace std { // \ref{string.view.template}, class template \tcode{basic_string_view} template> class basic_string_view; + template + inline constexpr bool ranges::enable_view> = true; template inline constexpr bool ranges::enable_safe_range> = true; diff --git a/source/support.tex b/source/support.tex index 3915f9acec..e482f0078f 100644 --- a/source/support.tex +++ b/source/support.tex @@ -586,6 +586,7 @@ #define @\defnlibxname{cpp_lib_complex_udls}@ 201309L // also in \libheader{complex} #define @\defnlibxname{cpp_lib_concepts}@ 201907L // also in \libheader{concepts} #define @\defnlibxname{cpp_lib_constexpr_algorithms}@ 201806L // also in \libheader{algorithm} +#define @\defnlibxname{cpp_lib_constexpr_complex}@ 201711L // also in \libheader{complex} #define @\defnlibxname{cpp_lib_constexpr_dynamic_alloc}@ 201907L // also in \libheader{memory} #define @\defnlibxname{cpp_lib_constexpr_functional}@ 201907L // also in \libheader{functional} #define @\defnlibxname{cpp_lib_constexpr_iterator}@ 201811L // also in \libheader{iterator} @@ -625,6 +626,7 @@ #define @\defnlibxname{cpp_lib_is_final}@ 201402L // also in \libheader{type_traits} #define @\defnlibxname{cpp_lib_is_invocable}@ 201703L // also in \libheader{type_traits} #define @\defnlibxname{cpp_lib_is_layout_compatible}@ 201907L // also in \libheader{type_traits} +#define @\defnlibxname{cpp_lib_is_nothrow_convertible}@ 201806L // also in \libheader{type_traits} #define @\defnlibxname{cpp_lib_is_null_pointer}@ 201309L // also in \libheader{type_traits} #define @\defnlibxname{cpp_lib_is_pointer_interconvertible}@ 201907L // also in \libheader{type_traits} #define @\defnlibxname{cpp_lib_is_swappable}@ 201603L // also in \libheader{type_traits} @@ -646,7 +648,6 @@ // also in \libheader{array}, \libheader{deque}, \libheader{forward_list}, \libheader{iterator}, \libheader{list}, \libheader{map}, \libheader{regex}, \libheader{set}, \libheader{string}, // \libheader{unordered_map}, \libheader{unordered_set}, \libheader{vector} #define @\defnlibxname{cpp_lib_not_fn}@ 201603L // also in \libheader{functional} -#define @\defnlibxname{cpp_lib_nothrow_convertible}@ 201806L // also in \libheader{type_traits} #define @\defnlibxname{cpp_lib_null_iterators}@ 201304L // also in \libheader{iterator} #define @\defnlibxname{cpp_lib_optional}@ 201606L // also in \libheader{optional} #define @\defnlibxname{cpp_lib_parallel_algorithm}@ 201603L // also in \libheader{algorithm}, \libheader{numeric} @@ -4600,13 +4601,13 @@ \begin{codeblock} template concept @\deflibconcept{three_way_comparable_with}@ = - @\exposconcept{weakly-equality-comparable-with}@ && - @\exposconcept{partially-ordered-with}@ && three_way_comparable && three_way_comparable && common_reference_with&, const remove_reference_t&> && three_way_comparable< common_reference_t&, const remove_reference_t&>, Cat> && + @\exposconcept{weakly-equality-comparable-with}@ && + @\exposconcept{partially-ordered-with}@ && requires(const remove_reference_t& t, const remove_reference_t& u) { { t <=> u } -> @\exposconcept{compares-as}@; { u <=> t } -> @\exposconcept{compares-as}@; @@ -4693,7 +4694,8 @@ is additionally consistent with the \tcode{totalOrder} operation as specified in ISO/IEC/IEEE 60559. \item - Otherwise, \tcode{strong_ordering(E <=> F)} if it is a well-formed expression. + Otherwise, \tcode{strong_ordering(compare_three_way()(E, F))} + if it is a well-formed expression. \item Otherwise, \tcode{strong_order(E, F)} is ill-formed. \begin{note} @@ -4740,7 +4742,8 @@ \item together, all positive NaN values. \end{itemize} \item - Otherwise, \tcode{weak_ordering(E <=> F)} if it is a well-formed expression. + Otherwise, \tcode{weak_ordering(compare_three_way()(E, F))} + if it is a well-formed expression. \item Otherwise, \tcode{weak_ordering(strong_order(E, F))} if it is a well-formed expression. @@ -4770,7 +4773,7 @@ with overload resolution performed in a context that does not include a declaration of \tcode{std::partial_order}. \item - Otherwise, \tcode{partial_ordering(E <=> F)} + Otherwise, \tcode{partial_ordering(compare_three_way()(E, F))} if it is a well-formed expression. \item Otherwise, \tcode{partial_ordering(weak_order(E, F))} @@ -4876,6 +4879,8 @@ \indexheader{coroutine}% \indexlibraryglobal{noop_coroutine_handle}% \begin{codeblock} +#include // see \ref{compare.syn} + namespace std { // \ref{coroutine.traits}, coroutine traits template diff --git a/source/threads.tex b/source/threads.tex index a85a18aea1..4dac305996 100644 --- a/source/threads.tex +++ b/source/threads.tex @@ -406,7 +406,6 @@ [[nodiscard]] bool stop_possible() const noexcept; [[nodiscard]] friend bool operator==(const stop_token& lhs, const stop_token& rhs) noexcept; - [[nodiscard]] friend bool operator!=(const stop_token& lhs, const stop_token& rhs) noexcept; friend void swap(stop_token& lhs, stop_token& rhs) noexcept; }; } @@ -542,7 +541,7 @@ otherwise, \tcode{true}. \end{itemdescr} -\rSec3[stoptoken.cmp]{Comparisons} +\rSec3[stoptoken.nonmembers]{Non-member functions} \indexlibrarymember{operator==}{stop_token}% \begin{itemdecl} @@ -557,19 +556,6 @@ otherwise \tcode{false}. \end{itemdescr} -\indexlibrarymember{operator!=}{stop_token}% -\begin{itemdecl} -[[nodiscard]] bool operator!=(const stop_token& lhs, const stop_token& rhs) noexcept; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\returns -\tcode{!(lhs==rhs)}. -\end{itemdescr} - -\rSec3[stoptoken.special]{Specialized algorithms} - \indexlibrarymember{swap}{stop_token}% \begin{itemdecl} friend void swap(stop_token& x, stop_token& y) noexcept; @@ -993,6 +979,9 @@ \indexheader{thread}% \begin{codeblock} +#include // see \ref{compare.syn} +#include // see \ref{initializer.list.syn} + namespace std { class thread; diff --git a/source/time.tex b/source/time.tex index 8b76208498..bbf398acf6 100644 --- a/source/time.tex +++ b/source/time.tex @@ -63,6 +63,8 @@ \indexlibrarymember{earliest}{choose}% \indexlibrarymember{latest}{choose}% \begin{codeblock} +#include // see \ref{compare.syn} + namespace std { namespace chrono { // \ref{time.duration}, class template \tcode{duration} @@ -2013,62 +2015,120 @@ \end{itemdecl} \begin{itemdescr} -\pnum -\mandates -\tcode{Rep} is an integral type -whose integer conversion rank\iref{conv.rank} -is greater than or equal to that of \tcode{short}, -or a floating-point type. -\tcode{charT} is \tcode{char} or \tcode{wchar_t}. - \pnum \effects -Forms a \tcode{basic_string} from \tcode{d.count()} -using \tcode{to_string} if \tcode{charT} is \tcode{char}, -or \tcode{to_wstring} if \tcode{charT} is \tcode{wchar_t}. -Appends the units suffix described below to the \tcode{basic_string}. -Inserts the resulting \tcode{basic_string} into \tcode{os}. -\begin{note} -This specification ensures that the result of this streaming operation -will obey the width and alignment properties of the stream. -\end{note} +Inserts the duration \tcode{d} onto the stream \tcode{os} +as if it were implemented as follows: +\begin{codeblock} +basic_ostringstream s; +s.flags(os.flags()); +s.imbue(os.getloc()); +s.precision(os.precision()); +s << d.count() << @\placeholder{units-suffix}@; +return os << s.str(); +\end{codeblock} +where \tcode{\placeholder{units-suffix}} +depends on the type \tcode{Period::type} as follows: -\pnum -The units suffix depends on the type \tcode{Period::type} as follows: \begin{itemize} -\item If \tcode{Period::type} is \tcode{atto}, the suffix is \tcode{"as"}. -\item Otherwise, if \tcode{Period::type} is \tcode{femto}, the suffix is \tcode{"fs"}. -\item Otherwise, if \tcode{Period::type} is \tcode{pico}, the suffix is \tcode{"ps"}. -\item Otherwise, if \tcode{Period::type} is \tcode{nano}, the suffix is \tcode{"ns"}. -\item Otherwise, if \tcode{Period::type} is \tcode{micro}, the suffix is \tcode{"\textmu{}s"} (\tcode{"\textbackslash{}u00b5\textbackslash{}u0073"}). -\item Otherwise, if \tcode{Period::type} is \tcode{milli}, the suffix is \tcode{"ms"}. -\item Otherwise, if \tcode{Period::type} is \tcode{centi}, the suffix is \tcode{"cs"}. -\item Otherwise, if \tcode{Period::type} is \tcode{deci}, the suffix is \tcode{"ds"}. -\item Otherwise, if \tcode{Period::type} is \tcode{ratio<1>}, the suffix is \tcode{"s"}. -\item Otherwise, if \tcode{Period::type} is \tcode{deca}, the suffix is \tcode{"das"}. -\item Otherwise, if \tcode{Period::type} is \tcode{hecto}, the suffix is \tcode{"hs"}. -\item Otherwise, if \tcode{Period::type} is \tcode{kilo}, the suffix is \tcode{"ks"}. -\item Otherwise, if \tcode{Period::type} is \tcode{mega}, the suffix is \tcode{"Ms"}. -\item Otherwise, if \tcode{Period::type} is \tcode{giga}, the suffix is \tcode{"Gs"}. -\item Otherwise, if \tcode{Period::type} is \tcode{tera}, the suffix is \tcode{"Ts"}. -\item Otherwise, if \tcode{Period::type} is \tcode{peta}, the suffix is \tcode{"Ps"}. -\item Otherwise, if \tcode{Period::type} is \tcode{exa}, the suffix is \tcode{"Es"}. -\item Otherwise, if \tcode{Period::type} is \tcode{ratio<60>}, the suffix is \tcode{"min"}. -\item Otherwise, if \tcode{Period::type} is \tcode{ratio<3600>}, the suffix is \tcode{"h"}. -\item Otherwise, if \tcode{Period::type} is \tcode{ratio<86400>}, the suffix is \tcode{"d"}. -\item Otherwise, if \tcode{Period::type::den == 1}, the suffix is \tcode{"[\placeholder{num}]s"}. -\item Otherwise, the suffix is \tcode{"[\placeholder{num}/\placeholder{den}]s"}. +\item +If \tcode{Period::type} is \tcode{atto}, +\tcode{\placeholder{units-suffix}} is \tcode{"as"}. + +\item +Otherwise, if \tcode{Period::type} is \tcode{femto}, +\tcode{\placeholder{units-suffix}} is \tcode{"fs"}. + +\item +Otherwise, if \tcode{Period::type} is \tcode{pico}, +\tcode{\placeholder{units-suffix}} is \tcode{"ps"}. + +\item +Otherwise, if \tcode{Period::type} is \tcode{nano}, +\tcode{\placeholder{units-suffix}} is \tcode{"ns"}. + +\item +Otherwise, if \tcode{Period::type} is \tcode{micro}, +\tcode{\placeholder{units-suffix}} is: +\begin{itemize} +\item \tcode{"\textmu{}s"} (\tcode{"\textbackslash{}u00b5\textbackslash{}u0073"}) if the character U+00B5 can be represented in the encoding used for \tcode{charT}; +\item \tcode{"us"} otherwise. \end{itemize} -In the list above the use of \tcode{\placeholder{num}} and \tcode{\placeholder{den}} + +\item +Otherwise, if \tcode{Period::type} is \tcode{milli}, +\tcode{\placeholder{units-suffix}} is \tcode{"ms"}. + +\item +Otherwise, if \tcode{Period::type} is \tcode{centi}, +\tcode{\placeholder{units-suffix}} is \tcode{"cs"}. + +\item +Otherwise, if \tcode{Period::type} is \tcode{deci}, +\tcode{\placeholder{units-suffix}} is \tcode{"ds"}. + +\item +Otherwise, if \tcode{Period::type} is \tcode{ratio<1>}, +\tcode{\placeholder{units-suffix}} is \tcode{"s"}. + +\item +Otherwise, if \tcode{Period::type} is \tcode{deca}, +\tcode{\placeholder{units-suffix}} is \tcode{"das"}. + +\item +Otherwise, if \tcode{Period::type} is \tcode{hecto}, +\tcode{\placeholder{units-suffix}} is \tcode{"hs"}. + +\item +Otherwise, if \tcode{Period::type} is \tcode{kilo}, +\tcode{\placeholder{units-suffix}} is \tcode{"ks"}. + +\item +Otherwise, if \tcode{Period::type} is \tcode{mega}, +\tcode{\placeholder{units-suffix}} is \tcode{"Ms"}. + +\item +Otherwise, if \tcode{Period::type} is \tcode{giga}, +\tcode{\placeholder{units-suffix}} is \tcode{"Gs"}. + +\item +Otherwise, if \tcode{Period::type} is \tcode{tera}, +\tcode{\placeholder{units-suffix}} is \tcode{"Ts"}. + +\item +Otherwise, if \tcode{Period::type} is \tcode{peta}, +\tcode{\placeholder{units-suffix}} is \tcode{"Ps"}. + +\item +Otherwise, if \tcode{Period::type} is \tcode{exa}, +\tcode{\placeholder{units-suffix}} is \tcode{"Es"}. + +\item +Otherwise, if \tcode{Period::type} is \tcode{ratio<60>}, +\tcode{\placeholder{units-suffix}} is \tcode{"min"}. + +\item +Otherwise, if \tcode{Period::type} is \tcode{ratio<3600>}, +\tcode{\placeholder{units-suffix}} is \tcode{"h"}. + +\item +Otherwise, if \tcode{Period::type} is \tcode{ratio<86400>}, +\tcode{\placeholder{units-suffix}} is \tcode{"d"}. + +\item +Otherwise, if \tcode{Period::type::den == 1}, +\tcode{\placeholder{units-suffix}} is \tcode{"[\placeholder{num}]s"}. + +\item +Otherwise, \tcode{\placeholder{units-suffix}} is +\tcode{"[\placeholder{num}/\placeholder{den}]s"}. +\end{itemize} + +In the list above, +the use of \tcode{\placeholder{num}} and \tcode{\placeholder{den}} refer to the static data members of \tcode{Period::type}, which are converted to arrays of \tcode{charT} using a decimal conversion with no leading zeroes. -\pnum -If \tcode{Period::type} is \tcode{micro}, -but the character U+00B5 cannot be represented in -the encoding used for \tcode{charT}, -the unit suffix \tcode{"us"} is used instead of \tcode{"\textmu{}s"}. - \pnum \returns \tcode{os}. @@ -2561,7 +2621,7 @@ \pnum Objects of type \tcode{system_clock} represent wall clock time from the system-wide realtime clock. -Objects of type \tcode{sys_time} measure time since (and before) +Objects of type \tcode{sys_time} measure time since 1970-01-01 00:00:00 UTC excluding leap seconds. This measure is commonly referred to as \defn{Unix time}. This measure facilitates an efficient mapping between @@ -2736,6 +2796,12 @@ which does not take leap seconds into account, \tcode{utc_clock} and its associated \tcode{time_point}, \tcode{utc_time}, count time, including leap seconds, since 1970-01-01 00:00:00 UTC. +\begin{note} +The UTC time standard began on 1972-01-01 00:00:10 TAI. +To measure time since this epoch instead, one can add/subtract the constant +\tcode{sys_days\{1972y/1/1\} - sys_days\{1970y/1/1\}} (\tcode{63'072'000s}) +from the \tcode{utc_time}. +\end{note} \begin{example} \\ \tcode{clock_cast(sys_seconds\{sys_days\{1970y/January/1\}\}).time_since_epoch()} is \tcode{0s}. \\ @@ -8428,7 +8494,7 @@ \pnum \ref{time.zone} describes an interface for accessing -the IANA Time Zone database described in RFC 6557, +the IANA Time Zone Database that interoperates with \tcode{sys_time} and \tcode{local_time}. This interface provides time zone support to both the civil calendar types\iref{time.cal} @@ -9372,31 +9438,32 @@ zoned_time(sys_time) -> zoned_time>; - template - zoned_time(TimeZonePtr, sys_time) - -> zoned_time, TimeZonePtr>; - - template - zoned_time(TimeZonePtr, local_time, choose = choose::earliest) - -> zoned_time, TimeZonePtr>; - - template - zoned_time(TimeZonePtr, zoned_time, choose = choose::earliest) - -> zoned_time, TimeZonePtr>; - - zoned_time(string_view) -> zoned_time; - - template - zoned_time(string_view, sys_time) - -> zoned_time>; - - template - zoned_time(string_view, local_time, choose = choose::earliest) - -> zoned_time>; - - template - zoned_time(TimeZonePtr, zoned_time, choose = choose::earliest) - -> zoned_time, TimeZonePtr>; + template + using @\exposid{time-zone-representation}@ = // \expos + conditional_t, + const time_zone*, + remove_cv_ref>; + + template + zoned_time(TimeZonePtrOrName&&) + -> zoned_time>; + + template + zoned_time(TimeZonePtrOrName&&, sys_time) + -> zoned_time, + @\exposid{time-zone-representation}@>; + + template + zoned_time(TimeZonePtrOrName&&, local_time, + choose = choose::earliest) + -> zoned_time, + @\exposid{time-zone-representation}@>; + + template + zoned_time(TimeZonePtrOrName&&, zoned_time, + choose = choose::earliest) + -> zoned_time, + @\exposid{time-zone-representation}@>; } \end{codeblock} @@ -9412,6 +9479,12 @@ If \tcode{Duration} is not a specialization of \tcode{chrono::duration}, the program is ill-formed. +\pnum +Every constructor of \tcode{zoned_time} that +accepts a \tcode{string_view} as its first parameter +does not participate in +class template argument deduction\iref{over.match.class.deduct}. + \rSec3[time.zone.zonedtime.ctor]{Constructors} \indexlibrary{\idxcode{zoned_time}!constructor|(}% @@ -10153,7 +10226,7 @@ \begin{ncbnf} \fmtnontermdef{type} \textnormal{one of}\br \terminal{a A b B c C d D e F g G h H I j m M n}\br - \terminal{p r R S t T u U V w W x X y Y z Z \%} + \terminal{p q Q r R S t T u U V w W x X y Y z Z \%} \end{ncbnf} The productions diff --git a/source/utilities.tex b/source/utilities.tex index cdff0e39f0..0a787e896d 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -41,6 +41,7 @@ throughout the rest of the library. \begin{codeblock} +#include // see \ref{compare.syn} #include // see \ref{initializer.list.syn} namespace std { @@ -519,7 +520,7 @@ \pnum The defaulted move and copy constructor, respectively, of \tcode{pair} is a constexpr function if and only if all required element-wise -initializations for copy and move, respectively, would satisfy the +initializations for move and copy, respectively, would satisfy the requirements for a constexpr function. \pnum @@ -971,6 +972,8 @@ \indexheader{tuple}% \begin{codeblock} +#include // see \ref{compare.syn} + namespace std { // \ref{tuple.tuple}, class template \tcode{tuple} template @@ -1157,7 +1160,7 @@ \pnum The defaulted move and copy constructor, respectively, of \tcode{tuple} is a constexpr function if and only if all -required element-wise initializations for copy and move, respectively, +required element-wise initializations for move and copy, respectively, would satisfy the requirements for a constexpr function. The defaulted move and copy constructor of \tcode{tuple<>} are constexpr functions. @@ -2136,6 +2139,8 @@ \indexheader{optional}% \begin{codeblock} +#include // see \ref{compare.syn} + namespace std { // \ref{optional.optional}, class template \tcode{optional} template @@ -3648,6 +3653,8 @@ \indexheader{variant}% \begin{codeblock} +#include // see \ref{compare.syn} + namespace std { // \ref{variant.variant}, class template \tcode{variant} template @@ -6501,6 +6508,8 @@ templates that operate on objects of these types\iref{smartptr}. \begin{codeblock} +#include // see \ref{compare.syn} + namespace std { // \ref{pointer.traits}, pointer traits template struct pointer_traits; @@ -6600,14 +6609,14 @@ namespace ranges { template<@\exposconcept{no-throw-forward-iterator}@ I, @\exposconcept{no-throw-sentinel}@ S> - requires default_constructible> + requires default_initializable> I uninitialized_default_construct(I first, S last); template<@\exposconcept{no-throw-forward-range}@ R> - requires default_constructible> + requires default_initializable> safe_iterator_t uninitialized_default_construct(R&& r); template<@\exposconcept{no-throw-forward-iterator}@ I> - requires default_constructible> + requires default_initializable> I uninitialized_default_construct_n(I first, iter_difference_t n); } @@ -6624,14 +6633,14 @@ namespace ranges { template<@\exposconcept{no-throw-forward-iterator}@ I, @\exposconcept{no-throw-sentinel}@ S> - requires default_constructible> + requires default_initializable> I uninitialized_value_construct(I first, S last); template<@\exposconcept{no-throw-forward-range}@ R> - requires default_constructible> + requires default_initializable> safe_iterator_t uninitialized_value_construct(R&& r); template<@\exposconcept{no-throw-forward-iterator}@ I> - requires default_constructible> + requires default_initializable> I uninitialized_value_construct_n(I first, iter_difference_t n); } @@ -6747,13 +6756,13 @@ template constexpr void destroy(ForwardIterator first, ForwardIterator last); template - constexpr void destroy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} - ForwardIterator first, ForwardIterator last); + void destroy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator first, ForwardIterator last); template constexpr ForwardIterator destroy_n(ForwardIterator first, Size n); template - constexpr ForwardIterator destroy_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} - ForwardIterator first, Size n); + ForwardIterator destroy_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator first, Size n); namespace ranges { template @@ -7605,8 +7614,9 @@ \effects Equivalent to: \begin{codeblock} -return ::new(static_cast(p)) - T(make_obj_using_allocator(alloc, std::forward(args)...)); +return apply([&](U&&... xs) { + return construct_at(p, std::forward(xs)...); + }, uses_allocator_construction_args(alloc, std::forward(args)...)); \end{codeblock} \end{itemdescr} @@ -7951,6 +7961,10 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\mandates +\tcode{T} is not an incomplete type\iref{basic.types}. + \pnum \returns A pointer to the initial element of an array of \tcode{n} \tcode{T}. @@ -8211,10 +8225,10 @@ \begin{itemdecl} namespace ranges { template<@\placeholdernc{no-throw-forward-iterator}@ I, @\placeholdernc{no-throw-sentinel}@ S> - requires default_constructible> + requires default_initializable> I uninitialized_default_construct(I first, S last); template<@\placeholdernc{no-throw-forward-range}@ R> - requires default_constructible> + requires default_initializable> safe_iterator_t uninitialized_default_construct(R&& r); } \end{itemdecl} @@ -8252,7 +8266,7 @@ \begin{itemdecl} namespace ranges { template<@\placeholdernc{no-throw-forward-iterator}@ I> - requires default_constructible> + requires default_initializable> I uninitialized_default_construct_n(I first, iter_difference_t n); } \end{itemdecl} @@ -8290,10 +8304,10 @@ \begin{itemdecl} namespace ranges { template<@\placeholdernc{no-throw-forward-iterator}@ I, @\placeholdernc{no-throw-sentinel}@ S> - requires default_constructible> + requires default_initializable> I uninitialized_value_construct(I first, S last); template<@\placeholdernc{no-throw-forward-range}@ R> - requires default_constructible> + requires default_initializable> safe_iterator_t uninitialized_value_construct(R&& r); } \end{itemdecl} @@ -8331,7 +8345,7 @@ \begin{itemdecl} namespace ranges { template<@\placeholdernc{no-throw-forward-iterator}@ I> - requires default_constructible> + requires default_initializable> I uninitialized_value_construct_n(I first, iter_difference_t n); } \end{itemdecl} @@ -10302,7 +10316,24 @@ \begin{itemdescr} \pnum -\requires Construction of \tcode{d} and a deleter of type \tcode{D} +\constraints +\tcode{is_move_constructible_v} is \tcode{true}, and +\tcode{d(p)} is a well-formed expression. +For the first two overloads: + +\begin{itemize} +\item +If \tcode{T} is an array type, then either +\tcode{T} is \tcode{U[N]} and \tcode{Y(*)[N]} is convertible to \tcode{T*}, or +\tcode{T} is \tcode{U[]} and \tcode{Y(*)[]} is convertible to \tcode{T*}. + +\item +If \tcode{T} is not an array type, then \tcode{Y*} is convertible to \tcode{T*}. +\end{itemize} + +\pnum +\expects +Construction of \tcode{d} and a deleter of type \tcode{D} initialized with \tcode{std::move(d)} shall not throw exceptions. The expression \tcode{d(p)} shall have well-defined behavior and shall not throw exceptions. @@ -10328,20 +10359,6 @@ \tcode{bad_alloc}, or an \impldef{exception type when \tcode{shared_ptr} constructor fails} exception when a resource other than memory could not be obtained. - -\pnum -\remarks -When \tcode{T} is an array type, -this constructor shall not participate in overload resolution unless -\tcode{is_move_constructible_v} is \tcode{true}, -the expression \tcode{d(p)} is well-formed, and either -\tcode{T} is \tcode{U[N]} and \tcode{Y(*)[N]} is convertible to \tcode{T*}, or -\tcode{T} is \tcode{U[]} and \tcode{Y(*)[]} is convertible to \tcode{T*}. -When \tcode{T} is not an array type, -this constructor shall not participate in overload resolution unless -\tcode{is_move_constructible_v} is \tcode{true}, -the expression \tcode{d(p)} is well-formed, and -\tcode{Y*} is convertible to \tcode{T*}. \end{itemdescr} \indexlibraryctor{shared_ptr}% @@ -12087,11 +12104,11 @@ [[nodiscard]] Tp* allocate(size_t n); void deallocate(Tp* p, size_t n); - void* allocate_bytes(size_t nbytes, size_t alignment = alignof(max_align_t)); + [[nodiscard]] void* allocate_bytes(size_t nbytes, size_t alignment = alignof(max_align_t)); void deallocate_bytes(void* p, size_t nbytes, size_t alignment = alignof(max_align_t)); - template T* allocate_object(size_t n = 1); + template [[nodiscard]] T* allocate_object(size_t n = 1); template void deallocate_object(T* p, size_t n = 1); - template T* new_object(CtorArgs&&... ctor_args); + template [[nodiscard]] T* new_object(CtorArgs&&... ctor_args); template void delete_object(T* p); template @@ -12166,7 +12183,8 @@ \begin{itemdescr} \pnum \effects -If \tcode{SIZE_MAX / sizeof(Tp) < n}, throws \tcode{length_error}. +If \tcode{numeric_limits::max() / sizeof(Tp) < n}, +throws \tcode{length_error}. Otherwise equivalent to: \begin{codeblock} return static_cast(memory_rsrc->allocate(n * sizeof(Tp), alignof(Tp))); @@ -12196,7 +12214,7 @@ \indexlibrarymember{allocate_bytes}{polymorphic_allocator}% \begin{itemdecl} -void* allocate_bytes(size_t nbytes, size_t alignment = alignof(max_align_t)); +[[nodiscard]] void* allocate_bytes(size_t nbytes, size_t alignment = alignof(max_align_t)); \end{itemdecl} \begin{itemdescr} @@ -12227,7 +12245,7 @@ \indexlibrarymember{allocate_object}{polymorphic_allocator}% \begin{itemdecl} template - T* allocate_object(size_t n = 1); + [[nodiscard]] T* allocate_object(size_t n = 1); \end{itemdecl} \begin{itemdescr} @@ -12237,7 +12255,8 @@ an array of \tcode{n} objects of type \tcode{T}, as follows: \begin{itemize} \item - if \tcode{SIZE_MAX / sizeof(T) < n}, throws \tcode{length_error}, + if \tcode{numeric_limits::max() / sizeof(T) < n}, + throws \tcode{length_error}, \item otherwise equivalent to: \begin{codeblock} @@ -12266,7 +12285,7 @@ \indexlibrarymember{new_object}{polymorphic_allocator}% \begin{itemdecl} template - T* new_object(CtorArgs&&... ctor_args); + [[nodiscard]] T* new_object(CtorArgs&&... ctor_args); \end{itemdecl} \begin{itemdescr} @@ -17825,9 +17844,8 @@ rank\iref{conv.rank} for which \tcode{sizeof(T) == sizeof(type)}, with the same cv-qualifiers as \tcode{T}.\br - \requires{} \tcode{T} shall be a (possibly cv-qualified) - integral type or enumeration - but not a \tcode{bool} type.\\ \rowsep + \mandates{} \tcode{T} is an integral or enumeration type + other than \cv~\tcode{bool}.\\ \rowsep \indexlibraryglobal{make_unsigned}% \tcode{template}\br @@ -17842,9 +17860,8 @@ rank\iref{conv.rank} for which \tcode{sizeof(T) == sizeof(type)}, with the same cv-qualifiers as \tcode{T}.\br - \requires{} \tcode{T} shall be a (possibly cv-qualified) - integral type or enumeration - but not a \tcode{bool} type.\\ + \mandates{} \tcode{T} is an integral or enumeration type + other than \cv~\tcode{bool}.\\ \rowsep \end{libreqtab2a} \rSec3[meta.trans.arr]{Array modifications} @@ -18766,6 +18783,8 @@ \indexheader{typeindex}% \begin{codeblock} +#include // see \ref{compare.syn} + namespace std { class type_index; template struct hash; @@ -19822,14 +19841,14 @@ \topline \lhdr{Option} & \rhdr{Meaning} \\ \rowsep \tcode{<} & -Forces the field to be left-aligned within the available space. +Forces the field to be aligned to the start of the available space. This is the default for non-arithmetic types, \tcode{charT}, and \tcode{bool}, unless an integer presentation type is specified. \\ \rowsep % \tcode{>} & -Forces the field to be right-aligned within the available space. +Forces the field to be aligned to the end of the available space. This is the default for arithmetic types other than \tcode{charT} and \tcode{bool} or when an integer presentation type is specified.