From 283c483d814ae1ecce936f4c228c532ef4fe17d9 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Fri, 5 Aug 2022 21:28:05 -0700 Subject: [PATCH 1/2] P1642R11 Freestanding Library: Easy [utilities], [ranges], and [iterators] Also mark ATOMIC_FLAG_INIT as freestanding (added by LWG3659). --- source/concepts.tex | 1 + source/intro.tex | 14 +- source/iterators.tex | 289 ++++++++++++++++++++------------------- source/lib-intro.tex | 93 +++++++++---- source/memory.tex | 213 +++++++++++++++-------------- source/meta.tex | 2 + source/ranges.tex | 314 ++++++++++++++++++++++++------------------- source/support.tex | 42 ++++-- source/threads.tex | 310 ++++++++++++++++++++++-------------------- source/utilities.tex | 152 +++++++++++---------- 10 files changed, 793 insertions(+), 637 deletions(-) diff --git a/source/concepts.tex b/source/concepts.tex index bdd3512057..0cf400e29e 100644 --- a/source/concepts.tex +++ b/source/concepts.tex @@ -169,6 +169,7 @@ \indexheader{concepts}% \begin{codeblock} +// all freestanding namespace std { // \ref{concepts.lang}, language-related concepts // \ref{concept.same}, concept \libconcept{same_as} diff --git a/source/intro.tex b/source/intro.tex index f24ffd011f..cce294040a 100644 --- a/source/intro.tex +++ b/source/intro.tex @@ -844,12 +844,16 @@ \pnum Two kinds of implementations are defined: a \defnadj{hosted}{implementation} and a -\defnadj{freestanding}{implementation}. For a hosted implementation, this -document defines the set of available libraries. A freestanding +\defnadj{freestanding}{implementation}. +A freestanding implementation is one in which execution may take place without the benefit of -an operating system, and has an \impldef{required libraries for freestanding -implementation} set of libraries that includes certain language-support -libraries\iref{compliance}. +an operating system. +A hosted implementation +supports all the facilities described in this document, while +a freestanding implementation +supports the entire \Cpp{} language +described in \ref{lex} through \ref{cpp} and +the subset of the library facilities described in \ref{compliance}. \pnum A conforming implementation may have extensions (including diff --git a/source/iterators.tex b/source/iterators.tex index 9c9606b0ae..e8887b29f7 100644 --- a/source/iterators.tex +++ b/source/iterators.tex @@ -45,30 +45,30 @@ // \ref{iterator.assoc.types}, associated types // \ref{incrementable.traits}, incrementable traits - template struct incrementable_traits; + template struct incrementable_traits; // freestanding template - using iter_difference_t = @\seebelow@; + using iter_difference_t = @\seebelow@; // freestanding // \ref{readable.traits}, indirectly readable traits - template struct indirectly_readable_traits; + template struct indirectly_readable_traits; // freestanding template - using iter_value_t = @\seebelow@; + using iter_value_t = @\seebelow@; // freestanding // \ref{iterator.traits}, iterator traits - template struct iterator_traits; - template requires is_object_v struct iterator_traits; + template struct iterator_traits; // freestanding + template requires is_object_v struct iterator_traits; // freestanding template<@\exposconcept{dereferenceable}@ T> - using iter_reference_t = decltype(*declval()); + using iter_reference_t = decltype(*declval()); // freestanding namespace ranges { // \ref{iterator.cust}, customization point objects inline namespace @\unspec@ { // \ref{iterator.cust.move}, \tcode{ranges::iter_move} - inline constexpr @\unspec@ iter_move = @\unspec@; + inline constexpr @\unspec@ iter_move = @\unspec@; // freestanding // \ref{iterator.cust.swap}, \tcode{ranges::iter_swap} - inline constexpr @\unspec@ iter_swap = @\unspec@; + inline constexpr @\unspec@ iter_swap = @\unspec@; // freestanding } } @@ -76,324 +76,325 @@ requires requires(T& t) { { ranges::iter_move(t) } -> @\exposconcept{can-reference}@; } - using iter_rvalue_reference_t + using iter_rvalue_reference_t // freestanding = decltype(ranges::iter_move(declval())); // \ref{iterator.concepts}, iterator concepts // \ref{iterator.concept.readable}, concept \libconcept{indirectly_readable} template - concept indirectly_readable = @\seebelow@; + concept indirectly_readable = @\seebelow@; // freestanding template<@\libconcept{indirectly_readable}@ T> - using iter_common_reference_t = + using iter_common_reference_t = // freestanding common_reference_t, iter_value_t&>; // \ref{iterator.concept.writable}, concept \libconcept{indirectly_writable} template - concept indirectly_writable = @\seebelow@; + concept indirectly_writable = @\seebelow@; // freestanding // \ref{iterator.concept.winc}, concept \libconcept{weakly_incrementable} template - concept weakly_incrementable = @\seebelow@; + concept weakly_incrementable = @\seebelow@; // freestanding // \ref{iterator.concept.inc}, concept \libconcept{incrementable} template - concept incrementable = @\seebelow@; + concept incrementable = @\seebelow@; // freestanding // \ref{iterator.concept.iterator}, concept \libconcept{input_or_output_iterator} template - concept input_or_output_iterator = @\seebelow@; + concept input_or_output_iterator = @\seebelow@; // freestanding // \ref{iterator.concept.sentinel}, concept \libconcept{sentinel_for} template - concept sentinel_for = @\seebelow@; + concept sentinel_for = @\seebelow@; // freestanding // \ref{iterator.concept.sizedsentinel}, concept \libconcept{sized_sentinel_for} template - inline constexpr bool disable_sized_sentinel_for = false; + inline constexpr bool disable_sized_sentinel_for = false; // freestanding template - concept sized_sentinel_for = @\seebelow@; + concept sized_sentinel_for = @\seebelow@; // freestanding // \ref{iterator.concept.input}, concept \libconcept{input_iterator} template - concept input_iterator = @\seebelow@; + concept input_iterator = @\seebelow@; // freestanding // \ref{iterator.concept.output}, concept \libconcept{output_iterator} template - concept output_iterator = @\seebelow@; + concept output_iterator = @\seebelow@; // freestanding // \ref{iterator.concept.forward}, concept \libconcept{forward_iterator} template - concept forward_iterator = @\seebelow@; + concept forward_iterator = @\seebelow@; // freestanding // \ref{iterator.concept.bidir}, concept \libconcept{bidirectional_iterator} template - concept bidirectional_iterator = @\seebelow@; + concept bidirectional_iterator = @\seebelow@; // freestanding // \ref{iterator.concept.random.access}, concept \libconcept{random_access_iterator} template - concept random_access_iterator = @\seebelow@; + concept random_access_iterator = @\seebelow@; // freestanding // \ref{iterator.concept.contiguous}, concept \libconcept{contiguous_iterator} template - concept contiguous_iterator = @\seebelow@; + concept contiguous_iterator = @\seebelow@; // freestanding // \ref{indirectcallable}, indirect callable requirements // \ref{indirectcallable.indirectinvocable}, indirect callables template - concept indirectly_unary_invocable = @\seebelow@; + concept indirectly_unary_invocable = @\seebelow@; // freestanding template - concept indirectly_regular_unary_invocable = @\seebelow@; + concept indirectly_regular_unary_invocable = @\seebelow@; // freestanding template - concept indirect_unary_predicate = @\seebelow@; + concept indirect_unary_predicate = @\seebelow@; // freestanding template - concept indirect_binary_predicate = @\seebelow@; + concept indirect_binary_predicate = @\seebelow@; // freestanding template - concept indirect_equivalence_relation = @\seebelow@; + concept indirect_equivalence_relation = @\seebelow@; // freestanding template - concept indirect_strict_weak_order = @\seebelow@; + concept indirect_strict_weak_order = @\seebelow@; // freestanding template requires (@\libconcept{indirectly_readable}@ && ...) && @\libconcept{invocable}@...> - using indirect_result_t = invoke_result_t...>; + using indirect_result_t = invoke_result_t...>; // freestanding // \ref{projected}, projected template<@\libconcept{indirectly_readable}@ I, @\libconcept{indirectly_regular_unary_invocable}@ Proj> - struct projected; + struct projected; // freestanding template<@\libconcept{weakly_incrementable}@ I, class Proj> - struct incrementable_traits>; + struct incrementable_traits>; // freestanding // \ref{alg.req}, common algorithm requirements // \ref{alg.req.ind.move}, concept \libconcept{indirectly_movable} template - concept indirectly_movable = @\seebelow@; + concept indirectly_movable = @\seebelow@; // freestanding template - concept indirectly_movable_storable = @\seebelow@; + concept indirectly_movable_storable = @\seebelow@; // freestanding // \ref{alg.req.ind.copy}, concept \libconcept{indirectly_copyable} template - concept indirectly_copyable = @\seebelow@; + concept indirectly_copyable = @\seebelow@; // freestanding template - concept indirectly_copyable_storable = @\seebelow@; + concept indirectly_copyable_storable = @\seebelow@; // freestanding // \ref{alg.req.ind.swap}, concept \libconcept{indirectly_swappable} template - concept indirectly_swappable = @\seebelow@; + concept indirectly_swappable = @\seebelow@; // freestanding // \ref{alg.req.ind.cmp}, concept \libconcept{indirectly_comparable} template - concept indirectly_comparable = @\seebelow@; + concept indirectly_comparable = @\seebelow@; // freestanding // \ref{alg.req.permutable}, concept \libconcept{permutable} template - concept permutable = @\seebelow@; + concept permutable = @\seebelow@; // freestanding // \ref{alg.req.mergeable}, concept \libconcept{mergeable} template - concept mergeable = @\seebelow@; + concept mergeable = @\seebelow@; // freestanding // \ref{alg.req.sortable}, concept \libconcept{sortable} template - concept sortable = @\seebelow@; + concept sortable = @\seebelow@; // freestanding // \ref{iterator.primitives}, primitives // \ref{std.iterator.tags}, iterator tags - struct input_iterator_tag { }; - struct output_iterator_tag { }; - struct forward_iterator_tag: public input_iterator_tag { }; - struct bidirectional_iterator_tag: public forward_iterator_tag { }; - struct random_access_iterator_tag: public bidirectional_iterator_tag { }; - struct contiguous_iterator_tag: public random_access_iterator_tag { }; + struct input_iterator_tag { }; // freestanding + struct output_iterator_tag { }; // freestanding + struct forward_iterator_tag: public input_iterator_tag { }; // freestanding + struct bidirectional_iterator_tag: public forward_iterator_tag { }; // freestanding + struct random_access_iterator_tag: public bidirectional_iterator_tag { }; // freestanding + struct contiguous_iterator_tag: public random_access_iterator_tag { }; // freestanding // \ref{iterator.operations}, iterator operations template constexpr void - advance(InputIterator& i, Distance n); + advance(InputIterator& i, Distance n); // freestanding template constexpr typename iterator_traits::difference_type - distance(InputIterator first, InputIterator last); + distance(InputIterator first, InputIterator last); // freestanding template constexpr InputIterator - next(InputIterator x, + next(InputIterator x, // freestanding typename iterator_traits::difference_type n = 1); template constexpr BidirectionalIterator - prev(BidirectionalIterator x, + prev(BidirectionalIterator x, // freestanding typename iterator_traits::difference_type n = 1); // \ref{range.iter.ops}, range iterator operations namespace ranges { // \ref{range.iter.op.advance}, \tcode{ranges::advance} template<@\libconcept{input_or_output_iterator}@ I> - constexpr void advance(I& i, iter_difference_t n); + constexpr void advance(I& i, iter_difference_t n); // freestanding template<@\libconcept{input_or_output_iterator}@ I, @\libconcept{sentinel_for}@ S> - constexpr void advance(I& i, S bound); + constexpr void advance(I& i, S bound); // freestanding template<@\libconcept{input_or_output_iterator}@ I, @\libconcept{sentinel_for}@ S> - constexpr iter_difference_t advance(I& i, iter_difference_t n, S bound); + constexpr iter_difference_t advance(I& i, iter_difference_t n, // freestanding + S bound); // \ref{range.iter.op.distance}, \tcode{ranges::distance} template<@\libconcept{input_or_output_iterator}@ I, @\libconcept{sentinel_for}@ S> requires (!@\libconcept{sized_sentinel_for}@) - constexpr iter_difference_t distance(I first, S last); + constexpr iter_difference_t distance(I first, S last); // freestanding template<@\libconcept{input_or_output_iterator}@ I, @\libconcept{sized_sentinel_for}@ S> - constexpr iter_difference_t distance(const I& first, const S& last); + constexpr iter_difference_t distance(const I& first, const S& last); // freestanding template<@\libconcept{range}@ R> - constexpr range_difference_t distance(R&& r); + constexpr range_difference_t distance(R&& r); // freestanding // \ref{range.iter.op.next}, \tcode{ranges::next} template<@\libconcept{input_or_output_iterator}@ I> - constexpr I next(I x); + constexpr I next(I x); // freestanding template<@\libconcept{input_or_output_iterator}@ I> - constexpr I next(I x, iter_difference_t n); + constexpr I next(I x, iter_difference_t n); // freestanding template<@\libconcept{input_or_output_iterator}@ I, @\libconcept{sentinel_for}@ S> - constexpr I next(I x, S bound); + constexpr I next(I x, S bound); // freestanding template<@\libconcept{input_or_output_iterator}@ I, @\libconcept{sentinel_for}@ S> - constexpr I next(I x, iter_difference_t n, S bound); + constexpr I next(I x, iter_difference_t n, S bound); // freestanding // \ref{range.iter.op.prev}, \tcode{ranges::prev} template<@\libconcept{bidirectional_iterator}@ I> - constexpr I prev(I x); + constexpr I prev(I x); // freestanding template<@\libconcept{bidirectional_iterator}@ I> - constexpr I prev(I x, iter_difference_t n); + constexpr I prev(I x, iter_difference_t n); // freestanding template<@\libconcept{bidirectional_iterator}@ I> - constexpr I prev(I x, iter_difference_t n, I bound); + constexpr I prev(I x, iter_difference_t n, I bound); // freestanding } // \ref{predef.iterators}, predefined iterators and sentinels // \ref{reverse.iterators}, reverse iterators - template class reverse_iterator; + template class reverse_iterator; // freestanding template - constexpr bool operator==( + constexpr bool operator==( // freestanding const reverse_iterator& x, const reverse_iterator& y); template - constexpr bool operator!=( + constexpr bool operator!=( // freestanding const reverse_iterator& x, const reverse_iterator& y); template - constexpr bool operator<( + constexpr bool operator<( // freestanding const reverse_iterator& x, const reverse_iterator& y); template - constexpr bool operator>( + constexpr bool operator>( // freestanding const reverse_iterator& x, const reverse_iterator& y); template - constexpr bool operator<=( + constexpr bool operator<=( // freestanding const reverse_iterator& x, const reverse_iterator& y); template - constexpr bool operator>=( + constexpr bool operator>=( // freestanding const reverse_iterator& x, const reverse_iterator& y); template Iterator2> constexpr compare_three_way_result_t - operator<=>(const reverse_iterator& x, + operator<=>(const reverse_iterator& x, // freestanding const reverse_iterator& y); template - constexpr auto operator-( + constexpr auto operator-( // freestanding const reverse_iterator& x, const reverse_iterator& y) -> decltype(y.base() - x.base()); template - constexpr reverse_iterator operator+( + constexpr reverse_iterator operator+( // freestanding iter_difference_t n, const reverse_iterator& x); template - constexpr reverse_iterator make_reverse_iterator(Iterator i); + constexpr reverse_iterator make_reverse_iterator(Iterator i); // freestanding template requires (!@\libconcept{sized_sentinel_for}@) - inline constexpr bool disable_sized_sentinel_for, + inline constexpr bool disable_sized_sentinel_for, // freestanding reverse_iterator> = true; // \ref{insert.iterators}, insert iterators - template class back_insert_iterator; + template class back_insert_iterator; // freestanding template - constexpr back_insert_iterator back_inserter(Container& x); + constexpr back_insert_iterator back_inserter(Container& x); // freestanding - template class front_insert_iterator; + template class front_insert_iterator; // freestanding template - constexpr front_insert_iterator front_inserter(Container& x); + constexpr front_insert_iterator front_inserter(Container& x); // freestanding - template class insert_iterator; + template class insert_iterator; // freestanding template constexpr insert_iterator - inserter(Container& x, ranges::iterator_t i); + inserter(Container& x, ranges::iterator_t i); // freestanding // \ref{move.iterators}, move iterators and sentinels - template class move_iterator; + template class move_iterator; // freestanding template - constexpr bool operator==( + constexpr bool operator==( // freestanding const move_iterator& x, const move_iterator& y); template - constexpr bool operator<( + constexpr bool operator<( // freestanding const move_iterator& x, const move_iterator& y); template - constexpr bool operator>( + constexpr bool operator>( // freestanding const move_iterator& x, const move_iterator& y); template - constexpr bool operator<=( + constexpr bool operator<=( // freestanding const move_iterator& x, const move_iterator& y); template - constexpr bool operator>=( + constexpr bool operator>=( // freestanding const move_iterator& x, const move_iterator& y); template Iterator2> constexpr compare_three_way_result_t - operator<=>(const move_iterator& x, + operator<=>(const move_iterator& x, // freestanding const move_iterator& y); template - constexpr auto operator-( + constexpr auto operator-( // freestanding const move_iterator& x, const move_iterator& y) -> decltype(x.base() - y.base()); template constexpr move_iterator - operator+(iter_difference_t n, const move_iterator& x); + operator+(iter_difference_t n, const move_iterator& x); // freestanding template - constexpr move_iterator make_move_iterator(Iterator i); + constexpr move_iterator make_move_iterator(Iterator i); // freestanding - template<@\libconcept{semiregular}@ S> class move_sentinel; + template<@\libconcept{semiregular}@ S> class move_sentinel; // freestanding // \ref{iterators.common}, common iterators template<@\libconcept{input_or_output_iterator}@ I, @\libconcept{sentinel_for}@ S> requires (!@\libconcept{same_as}@ && @\libconcept{copyable}@) - class common_iterator; + class common_iterator; // freestanding template - struct incrementable_traits>; + struct incrementable_traits>; // freestanding template<@\libconcept{input_iterator}@ I, class S> - struct iterator_traits>; + struct iterator_traits>; // freestanding // \ref{default.sentinel}, default sentinel - struct default_sentinel_t; - inline constexpr default_sentinel_t @\libglobal{default_sentinel}@{}; + struct default_sentinel_t; // freestanding + inline constexpr default_sentinel_t @\libglobal{default_sentinel}@{}; // freestanding // \ref{iterators.counted}, counted iterators - template<@\libconcept{input_or_output_iterator}@ I> class counted_iterator; + template<@\libconcept{input_or_output_iterator}@ I> class counted_iterator; // freestanding template<@\libconcept{input_iterator}@ I> requires @\seebelow@ - struct iterator_traits>; + struct iterator_traits>; // freestanding // \ref{unreachable.sentinel}, unreachable sentinel - struct unreachable_sentinel_t; - inline constexpr unreachable_sentinel_t @\libglobal{unreachable_sentinel}@{}; + struct unreachable_sentinel_t; // freestanding + inline constexpr unreachable_sentinel_t @\libglobal{unreachable_sentinel}@{}; // freestanding // \ref{stream.iterators}, stream iterators template, @@ -416,39 +417,53 @@ class ostreambuf_iterator; // \ref{iterator.range}, range access - template constexpr auto begin(C& c) -> decltype(c.begin()); - template constexpr auto begin(const C& c) -> decltype(c.begin()); - template constexpr auto end(C& c) -> decltype(c.end()); - template constexpr auto end(const C& c) -> decltype(c.end()); - template constexpr T* begin(T (&array)[N]) noexcept; - template constexpr T* end(T (&array)[N]) noexcept; - template constexpr auto cbegin(const C& c) noexcept(noexcept(std::begin(c))) - -> decltype(std::begin(c)); - template constexpr auto cend(const C& c) noexcept(noexcept(std::end(c))) - -> decltype(std::end(c)); - template constexpr auto rbegin(C& c) -> decltype(c.rbegin()); - template constexpr auto rbegin(const C& c) -> decltype(c.rbegin()); - template constexpr auto rend(C& c) -> decltype(c.rend()); - template constexpr auto rend(const C& c) -> decltype(c.rend()); - template constexpr reverse_iterator rbegin(T (&array)[N]); - template constexpr reverse_iterator rend(T (&array)[N]); - template constexpr reverse_iterator rbegin(initializer_list il); - template constexpr reverse_iterator rend(initializer_list il); - template constexpr auto crbegin(const C& c) -> decltype(std::rbegin(c)); - template constexpr auto crend(const C& c) -> decltype(std::rend(c)); - - template constexpr auto size(const C& c) -> decltype(c.size()); - template constexpr size_t size(const T (&array)[N]) noexcept; - template constexpr auto ssize(const C& c) - -> common_type_t>; - template constexpr ptrdiff_t ssize(const T (&array)[N]) noexcept; - template [[nodiscard]] constexpr auto empty(const C& c) -> decltype(c.empty()); - template [[nodiscard]] constexpr bool empty(const T (&array)[N]) noexcept; - template [[nodiscard]] constexpr bool empty(initializer_list il) noexcept; - template constexpr auto data(C& c) -> decltype(c.data()); - template constexpr auto data(const C& c) -> decltype(c.data()); - template constexpr T* data(T (&array)[N]) noexcept; - template constexpr const E* data(initializer_list il) noexcept; + template constexpr auto begin(C& c) -> decltype(c.begin()); // freestanding + template constexpr auto begin(const C& c) -> decltype(c.begin()); // freestanding + template constexpr auto end(C& c) -> decltype(c.end()); // freestanding + template constexpr auto end(const C& c) -> decltype(c.end()); // freestanding + template constexpr T* begin(T (&array)[N]) noexcept; // freestanding + template constexpr T* end(T (&array)[N]) noexcept; // freestanding + template constexpr auto cbegin(const C& c) // freestanding + noexcept(noexcept(std::begin(c))) -> decltype(std::begin(c)); + template constexpr auto cend(const C& c) // freestanding + noexcept(noexcept(std::end(c))) -> decltype(std::end(c)); + template constexpr auto rbegin(C& c) -> decltype(c.rbegin()); // freestanding + template constexpr auto rbegin(const C& c) -> decltype(c.rbegin()); // freestanding + template constexpr auto rend(C& c) -> decltype(c.rend()); // freestanding + template constexpr auto rend(const C& c) -> decltype(c.rend()); // freestanding + template constexpr reverse_iterator rbegin(T (&array)[N]) // freestanding + template constexpr reverse_iterator rend(T (&array)[N]); // freestanding + template constexpr reverse_iterator + rbegin(initializer_list il); // freestanding + template constexpr reverse_iterator + rend(initializer_list il); // freestanding + template constexpr auto + crbegin(const C& c) -> decltype(std::rbegin(c)); // freestanding + template constexpr auto + crend(const C& c) -> decltype(std::rend(c)); // freestanding + + template constexpr auto + size(const C& c) -> decltype(c.size()); // freestanding + template constexpr size_t + size(const T (&array)[N]) noexcept; // freestanding + + template constexpr auto + ssize(const C& c) + -> common_type_t>; // freestanding + template constexpr ptrdiff_t + ssize(const T (&array)[N]) noexcept; // freestanding + + template [[nodiscard]] constexpr auto + empty(const C& c) -> decltype(c.empty()); // freestanding + template [[nodiscard]] constexpr bool + empty(const T (&array)[N]) noexcept; // freestanding + template [[nodiscard]] constexpr bool + empty(initializer_list il) noexcept; // freestanding + + template constexpr auto data(C& c) -> decltype(c.data()); // freestanding + template constexpr auto data(const C& c) -> decltype(c.data()); // freestanding + template constexpr T* data(T (&array)[N]) noexcept; // freestanding + template constexpr const E* data(initializer_list il) noexcept; // freestanding } \end{codeblock} diff --git a/source/lib-intro.tex b/source/lib-intro.tex index dfef1f18ae..d42071dc91 100644 --- a/source/lib-intro.tex +++ b/source/lib-intro.tex @@ -908,6 +908,52 @@ \pnum An implementation may use any technique that provides equivalent observable behavior. +\rSec3[freestanding.entity]{Freestanding entities} + +\pnum +\indextext{entity!freestanding|see{freestanding entity}}% +A \defn{freestanding entity} is a declaration or macro definition +that is present in a freestanding implementation and a hosted implementation. + +\pnum +Unless otherwise specified, +the requirements on freestanding entities on a freestanding implementation +are the same as the corresponding requirements in a hosted implementation. + +\pnum +In a header synopsis, entities followed with a comment +that includes \textit{freestanding} are freestanding entities. +\begin{example} +\begin{codeblock} +#define NULL @\seebelow@ // freestanding +\end{codeblock} +\end{example} + +\pnum +If a header synopsis begins with a comment +that includes \textit{all freestanding}, +then all of the declarations and macro definitions in the header synopsis +are freestanding entities. +\begin{example} +\begin{codeblock} +// all freestanding +namespace std { +\end{codeblock} +\end{example} + +\pnum +Deduction guides for freestanding entity class templates are freestanding entities. + +\pnum +Enclosing namespaces of freestanding entities are freestanding entities. + +\pnum +Friends of freestanding entities are freestanding entities. + +\pnum +Entities denoted by freestanding entity \grammarterm{typedef-name}{s} and +freestanding entity alias templates are freestanding entities. + \rSec1[requirements]{Library-wide requirements} \rSec2[requirements.general]{General} @@ -1350,38 +1396,31 @@ \ref{concepts} & Concepts library & \tcode{} \\ \rowsep \ref{type.traits} & Type traits & \tcode{} \\ \rowsep \ref{bit} & Bit manipulation & \tcode{} \\ \rowsep -\ref{atomics} & Atomics & \tcode{} \\ +\ref{atomics} & Atomics & \tcode{} \\ \rowsep +\ref{utility} & Utility components & \tcode{} \\ \rowsep +\ref{tuple} & Tuples & \tcode{} \\ \rowsep +\ref{memory} & Memory & \tcode{} \\ \rowsep +\ref{function.objects} & Function objects & \tcode{} \\ \rowsep +\ref{ratio} & Compile-time rational arithmetic & \tcode{} \\ \rowsep +\ref{iterators} & Iterators library & \tcode{} \\ \rowsep +\ref{ranges} & Ranges library & \tcode{} \\ \end{libsumtab} \pnum -The supplied version of the header \libheaderref{cstdlib} -shall declare at least the functions -\indexlibraryglobal{abort}% -\tcode{abort}, -\indexlibraryglobal{atexit}% -\tcode{atexit}, -\indexlibraryglobal{at_quick_exit}% -\tcode{at_quick_exit}, -\indexlibraryglobal{exit}% -\tcode{exit}, -and -\indexlibraryglobal{quick_exit}% -\tcode{quick_exit}\iref{support.start.term}. -\indextext{implementation!hosted}% -The supplied version of the header \libheaderrefx{atomic}{atomics.syn} -shall meet the same requirements as for a hosted implementation -except that support for -always lock-free integral atomic types\iref{atomics.lockfree} -is \impldef{support for always lock-free integral atomic types in -freestanding environments}, and -whether or not the type aliases \tcode{atomic_signed_lock_free} and -\tcode{atomic_unsigned_lock_free} are defined\iref{atomics.alias} -is \impldef{type aliases \tcode{atomic_signed_lock_free} and -\tcode{atomic_unsigned_lock_free} in freestanding environments}. -The other headers listed in this table -shall meet the same requirements as for a hosted implementation. +For each of the headers listed in \tref{headers.cpp.fs}, +a freestanding implementation provides at least +the freestanding entities\iref{freestanding.entity} declared in the header. \indextext{implementation!freestanding|)}% +\pnum +\begin{note} +Throwing a standard library provided exception +is not observably different from \tcode{terminate()} +if the implementation does not +unwind the stack during exception handling\iref{except.handle} and +the user's program contains no catch blocks. +\end{note} + \rSec2[using]{Using the library} \rSec3[using.overview]{Overview} diff --git a/source/memory.tex b/source/memory.tex index 8491e64339..7c5f586fee 100644 --- a/source/memory.tex +++ b/source/memory.tex @@ -70,75 +70,79 @@ namespace std { // \ref{pointer.traits}, pointer traits - template struct pointer_traits; - template struct pointer_traits; + template struct pointer_traits; // freestanding + template struct pointer_traits; // freestanding // \ref{pointer.conversion}, pointer conversion template - constexpr T* to_address(T* p) noexcept; + constexpr T* to_address(T* p) noexcept; // freestanding template - constexpr auto to_address(const Ptr& p) noexcept; + constexpr auto to_address(const Ptr& p) noexcept; // freestanding // \ref{ptr.align}, pointer alignment - void* align(size_t alignment, size_t size, void*& ptr, size_t& space); + void* align(size_t alignment, size_t size, void*& ptr, size_t& space); // freestanding template - [[nodiscard]] constexpr T* assume_aligned(T* ptr); + [[nodiscard]] constexpr T* assume_aligned(T* ptr); // freestanding // \ref{allocator.tag}, allocator argument tag - struct allocator_arg_t { explicit allocator_arg_t() = default; }; - inline constexpr allocator_arg_t allocator_arg{}; + struct allocator_arg_t { // freestanding + explicit allocator_arg_t() = default; // freestanding + }; + inline constexpr allocator_arg_t allocator_arg{}; // freestanding // \ref{allocator.uses}, \tcode{uses_allocator} - template struct uses_allocator; + template struct uses_allocator; // freestanding // \ref{allocator.uses.trait}, \tcode{uses_allocator} template - inline constexpr bool @\libglobal{uses_allocator_v}@ = uses_allocator::value; + inline constexpr bool @\libglobal{uses_allocator_v}@ = uses_allocator::value; // freestanding // \ref{allocator.uses.construction}, uses-allocator construction template - constexpr auto uses_allocator_construction_args(const Alloc& alloc, + constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding Args&&... args) noexcept; template - constexpr auto uses_allocator_construction_args(const Alloc& alloc, piecewise_construct_t, + constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding + piecewise_construct_t, Tuple1&& x, Tuple2&& y) noexcept; template - constexpr auto uses_allocator_construction_args(const Alloc& alloc) noexcept; + constexpr auto uses_allocator_construction_args(const Alloc& alloc) noexcept; // freestanding template - constexpr auto uses_allocator_construction_args(const Alloc& alloc, + constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding U&& u, V&& v) noexcept; template - constexpr auto uses_allocator_construction_args(const Alloc& alloc, + constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding pair& pr) noexcept; template - constexpr auto uses_allocator_construction_args(const Alloc& alloc, + constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding const pair& pr) noexcept; template - constexpr auto uses_allocator_construction_args(const Alloc& alloc, + constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding pair&& pr) noexcept; template - constexpr auto uses_allocator_construction_args(const Alloc& alloc, + constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding const pair&& pr) noexcept; template - constexpr auto uses_allocator_construction_args(const Alloc& alloc, U&& u) noexcept; + constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding + U&& u) noexcept; template - constexpr T make_obj_using_allocator(const Alloc& alloc, Args&&... args); + constexpr T make_obj_using_allocator(const Alloc& alloc, Args&&... args); // freestanding template - constexpr T* uninitialized_construct_using_allocator(T* p, const Alloc& alloc, - Args&&... args); + constexpr T* uninitialized_construct_using_allocator(T* p, // freestanding + const Alloc& alloc, Args&&... args); // \ref{allocator.traits}, allocator traits - template struct allocator_traits; + template struct allocator_traits; // freestanding template - struct allocation_result { + struct allocation_result { // freestanding Pointer ptr; size_t count; }; template [[nodiscard]] constexpr allocation_result::pointer> - allocate_at_least(Allocator& a, size_t n); + allocate_at_least(Allocator& a, size_t n); // freestanding // \ref{default.allocator}, the default allocator template class allocator; @@ -147,9 +151,9 @@ // \ref{specialized.addressof}, addressof template - constexpr T* addressof(T& r) noexcept; + constexpr T* addressof(T& r) noexcept; // freestanding template - const T* addressof(const T&&) = delete; + const T* addressof(const T&&) = delete; // freestanding // \ref{specialized.algorithms}, specialized algorithms // \ref{special.mem.concepts}, special memory concepts @@ -165,208 +169,214 @@ concept @\exposconcept{nothrow-forward-range}@ = @\seebelow@; // \expos template - void uninitialized_default_construct(NoThrowForwardIterator first, + void uninitialized_default_construct(NoThrowForwardIterator first, // freestanding NoThrowForwardIterator last); template - void uninitialized_default_construct(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void uninitialized_default_construct(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} NoThrowForwardIterator first, NoThrowForwardIterator last); template NoThrowForwardIterator - uninitialized_default_construct_n(NoThrowForwardIterator first, Size n); + uninitialized_default_construct_n(NoThrowForwardIterator first, Size n); // freestanding template NoThrowForwardIterator - uninitialized_default_construct_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + uninitialized_default_construct_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} NoThrowForwardIterator first, Size n); namespace ranges { template<@\exposconcept{nothrow-forward-iterator}@ I, @\exposconcept{nothrow-sentinel-for}@ S> requires @\libconcept{default_initializable}@> - I uninitialized_default_construct(I first, S last); + I uninitialized_default_construct(I first, S last); // freestanding template<@\exposconcept{nothrow-forward-range}@ R> requires @\libconcept{default_initializable}@> - borrowed_iterator_t uninitialized_default_construct(R&& r); + borrowed_iterator_t uninitialized_default_construct(R&& r); // freestanding template<@\exposconcept{nothrow-forward-iterator}@ I> requires @\libconcept{default_initializable}@> - I uninitialized_default_construct_n(I first, iter_difference_t n); + I uninitialized_default_construct_n(I first, iter_difference_t n); // freestanding } template - void uninitialized_value_construct(NoThrowForwardIterator first, + void uninitialized_value_construct(NoThrowForwardIterator first, // freestanding NoThrowForwardIterator last); template - void uninitialized_value_construct(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void uninitialized_value_construct(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} NoThrowForwardIterator first, NoThrowForwardIterator last); template NoThrowForwardIterator - uninitialized_value_construct_n(NoThrowForwardIterator first, Size n); + uninitialized_value_construct_n(NoThrowForwardIterator first, Size n); // freestanding template NoThrowForwardIterator - uninitialized_value_construct_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + uninitialized_value_construct_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} NoThrowForwardIterator first, Size n); namespace ranges { template<@\exposconcept{nothrow-forward-iterator}@ I, @\exposconcept{nothrow-sentinel-for}@ S> requires @\libconcept{default_initializable}@> - I uninitialized_value_construct(I first, S last); + I uninitialized_value_construct(I first, S last); // freestanding template<@\exposconcept{nothrow-forward-range}@ R> requires @\libconcept{default_initializable}@> - borrowed_iterator_t uninitialized_value_construct(R&& r); + borrowed_iterator_t uninitialized_value_construct(R&& r); // freestanding template<@\exposconcept{nothrow-forward-iterator}@ I> requires @\libconcept{default_initializable}@> - I uninitialized_value_construct_n(I first, iter_difference_t n); + I uninitialized_value_construct_n(I first, iter_difference_t n); // freestanding } template - NoThrowForwardIterator uninitialized_copy(InputIterator first, InputIterator last, + NoThrowForwardIterator uninitialized_copy(InputIterator first, // freestanding + InputIterator last, NoThrowForwardIterator result); template - NoThrowForwardIterator uninitialized_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + NoThrowForwardIterator uninitialized_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, NoThrowForwardIterator result); template - NoThrowForwardIterator uninitialized_copy_n(InputIterator first, Size n, + NoThrowForwardIterator uninitialized_copy_n(InputIterator first, Size n, // freestanding NoThrowForwardIterator result); template - NoThrowForwardIterator uninitialized_copy_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + NoThrowForwardIterator uninitialized_copy_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, Size n, NoThrowForwardIterator result); namespace ranges { template - using uninitialized_copy_result = in_out_result; + using uninitialized_copy_result = in_out_result; // freestanding template<@\libconcept{input_iterator}@ I, @\libconcept{sentinel_for}@ S1, @\exposconcept{nothrow-forward-iterator}@ O, @\exposconcept{nothrow-sentinel-for}@ S2> requires @\libconcept{constructible_from}@, iter_reference_t> uninitialized_copy_result - uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast); + uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast); // freestanding template<@\libconcept{input_range}@ IR, @\exposconcept{nothrow-forward-range}@ OR> requires @\libconcept{constructible_from}@, range_reference_t> uninitialized_copy_result, borrowed_iterator_t> - uninitialized_copy(IR&& in_range, OR&& out_range); + uninitialized_copy(IR&& in_range, OR&& out_range); // freestanding template - using uninitialized_copy_n_result = in_out_result; + using uninitialized_copy_n_result = in_out_result; // freestanding template<@\libconcept{input_iterator}@ I, @\exposconcept{nothrow-forward-iterator}@ O, @\exposconcept{nothrow-sentinel-for}@ S> requires @\libconcept{constructible_from}@, iter_reference_t> uninitialized_copy_n_result - uninitialized_copy_n(I ifirst, iter_difference_t n, O ofirst, S olast); + uninitialized_copy_n(I ifirst, iter_difference_t n, // freestanding + O ofirst, S olast); } template - NoThrowForwardIterator uninitialized_move(InputIterator first, InputIterator last, + NoThrowForwardIterator uninitialized_move(InputIterator first, // freestanding + InputIterator last, NoThrowForwardIterator result); template - NoThrowForwardIterator uninitialized_move(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + NoThrowForwardIterator uninitialized_move(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, NoThrowForwardIterator result); template pair - uninitialized_move_n(InputIterator first, Size n, NoThrowForwardIterator result); + uninitialized_move_n(InputIterator first, Size n, // freestanding + NoThrowForwardIterator result); template pair - uninitialized_move_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + uninitialized_move_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, Size n, NoThrowForwardIterator result); namespace ranges { template - using uninitialized_move_result = in_out_result; + using uninitialized_move_result = in_out_result; // freestanding template<@\libconcept{input_iterator}@ I, @\libconcept{sentinel_for}@ S1, @\exposconcept{nothrow-forward-iterator}@ O, @\exposconcept{nothrow-sentinel-for}@ S2> requires @\libconcept{constructible_from}@, iter_rvalue_reference_t> uninitialized_move_result - uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast); + uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast); // freestanding template<@\libconcept{input_range}@ IR, @\exposconcept{nothrow-forward-range}@ OR> requires @\libconcept{constructible_from}@, range_rvalue_reference_t> uninitialized_move_result, borrowed_iterator_t> - uninitialized_move(IR&& in_range, OR&& out_range); + uninitialized_move(IR&& in_range, OR&& out_range); // freestanding template - using uninitialized_move_n_result = in_out_result; + using uninitialized_move_n_result = in_out_result; // freestanding template<@\libconcept{input_iterator}@ I, @\exposconcept{nothrow-forward-iterator}@ O, @\exposconcept{nothrow-sentinel-for}@ S> requires @\libconcept{constructible_from}@, iter_rvalue_reference_t> uninitialized_move_n_result - uninitialized_move_n(I ifirst, iter_difference_t n, O ofirst, S olast); + uninitialized_move_n(I ifirst, iter_difference_t n, // freestanding + O ofirst, S olast); } template - void uninitialized_fill(NoThrowForwardIterator first, NoThrowForwardIterator last, - const T& x); + void uninitialized_fill(NoThrowForwardIterator first, // freestanding + NoThrowForwardIterator last, const T& x); template - void uninitialized_fill(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void uninitialized_fill(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} NoThrowForwardIterator first, NoThrowForwardIterator last, const T& x); template NoThrowForwardIterator - uninitialized_fill_n(NoThrowForwardIterator first, Size n, const T& x); + uninitialized_fill_n(NoThrowForwardIterator first, Size n, const T& x); // freestanding template NoThrowForwardIterator - uninitialized_fill_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + uninitialized_fill_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} NoThrowForwardIterator first, Size n, const T& x); namespace ranges { template<@\exposconcept{nothrow-forward-iterator}@ I, @\exposconcept{nothrow-sentinel-for}@ S, class T> requires @\libconcept{constructible_from}@, const T&> - I uninitialized_fill(I first, S last, const T& x); + I uninitialized_fill(I first, S last, const T& x); // freestanding template<@\exposconcept{nothrow-forward-range}@ R, class T> requires @\libconcept{constructible_from}@, const T&> - borrowed_iterator_t uninitialized_fill(R&& r, const T& x); + borrowed_iterator_t uninitialized_fill(R&& r, const T& x); // freestanding template<@\exposconcept{nothrow-forward-iterator}@ I, class T> requires @\libconcept{constructible_from}@, const T&> - I uninitialized_fill_n(I first, iter_difference_t n, const T& x); + I uninitialized_fill_n(I first, iter_difference_t n, const T& x); // freestanding } // \ref{specialized.construct}, \tcode{construct_at} template - constexpr T* construct_at(T* location, Args&&... args); + constexpr T* construct_at(T* location, Args&&... args); // freestanding namespace ranges { template - constexpr T* construct_at(T* location, Args&&... args); + constexpr T* construct_at(T* location, Args&&... args); // freestanding } // \ref{specialized.destroy}, \tcode{destroy} template - constexpr void destroy_at(T* location); + constexpr void destroy_at(T* location); // freestanding template constexpr void destroy(NoThrowForwardIterator first, NoThrowForwardIterator last); template - void destroy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void destroy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} NoThrowForwardIterator first, NoThrowForwardIterator last); template - constexpr NoThrowForwardIterator destroy_n(NoThrowForwardIterator first, Size n); + constexpr NoThrowForwardIterator destroy_n(NoThrowForwardIterator first, // freestanding + Size n); template - NoThrowForwardIterator destroy_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + NoThrowForwardIterator destroy_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} NoThrowForwardIterator first, Size n); namespace ranges { template<@\libconcept{destructible}@ T> - constexpr void destroy_at(T* location) noexcept; + constexpr void destroy_at(T* location) noexcept; // freestanding template<@\exposconcept{nothrow-input-iterator}@ I, @\exposconcept{nothrow-sentinel-for}@ S> requires @\libconcept{destructible}@> - constexpr I destroy(I first, S last) noexcept; + constexpr I destroy(I first, S last) noexcept; // freestanding template<@\exposconcept{nothrow-input-range}@ R> requires @\libconcept{destructible}@> - constexpr borrowed_iterator_t destroy(R&& r) noexcept; + constexpr borrowed_iterator_t destroy(R&& r) noexcept; // freestanding template<@\exposconcept{nothrow-input-iterator}@ I> requires @\libconcept{destructible}@> - constexpr I destroy_n(I first, iter_difference_t n) noexcept; + constexpr I destroy_n(I first, iter_difference_t n) noexcept; // freestanding } // \ref{unique.ptr}, class template \tcode{unique_ptr} - template struct default_delete; - template struct default_delete; - template> class unique_ptr; - template class unique_ptr; + template struct default_delete; // freestanding + template struct default_delete; // freestanding + template> class unique_ptr; // freestanding + template class unique_ptr; // freestanding template constexpr unique_ptr make_unique(Args&&... args); // \tcode{T} is not array @@ -383,47 +393,48 @@ @\unspecnc@ make_unique_for_overwrite(Args&&...) = delete; // \tcode{T} is \tcode{U[N]} template - constexpr void swap(unique_ptr& x, unique_ptr& y) noexcept; + constexpr void swap(unique_ptr& x, unique_ptr& y) noexcept; // freestanding template - constexpr bool operator==(const unique_ptr& x, const unique_ptr& y); + constexpr bool operator==(const unique_ptr& x, // freestanding + const unique_ptr& y); template - bool operator<(const unique_ptr& x, const unique_ptr& y); + bool operator<(const unique_ptr& x, const unique_ptr& y); // freestanding template - bool operator>(const unique_ptr& x, const unique_ptr& y); + bool operator>(const unique_ptr& x, const unique_ptr& y); // freestanding template - bool operator<=(const unique_ptr& x, const unique_ptr& y); + bool operator<=(const unique_ptr& x, const unique_ptr& y); // freestanding template - bool operator>=(const unique_ptr& x, const unique_ptr& y); + bool operator>=(const unique_ptr& x, const unique_ptr& y); // freestanding template requires @\libconcept{three_way_comparable_with}@::pointer, typename unique_ptr::pointer> compare_three_way_result_t::pointer, typename unique_ptr::pointer> - operator<=>(const unique_ptr& x, const unique_ptr& y); + operator<=>(const unique_ptr& x, const unique_ptr& y); // freestanding template - constexpr bool operator==(const unique_ptr& x, nullptr_t) noexcept; + constexpr bool operator==(const unique_ptr& x, nullptr_t) noexcept; // freestanding template - constexpr bool operator<(const unique_ptr& x, nullptr_t); + constexpr bool operator<(const unique_ptr& x, nullptr_t); // freestanding template - constexpr bool operator<(nullptr_t, const unique_ptr& y); + constexpr bool operator<(nullptr_t, const unique_ptr& y); // freestanding template - constexpr bool operator>(const unique_ptr& x, nullptr_t); + constexpr bool operator>(const unique_ptr& x, nullptr_t); // freestanding template - constexpr bool operator>(nullptr_t, const unique_ptr& y); + constexpr bool operator>(nullptr_t, const unique_ptr& y); // freestanding template - constexpr bool operator<=(const unique_ptr& x, nullptr_t); + constexpr bool operator<=(const unique_ptr& x, nullptr_t); // freestanding template - constexpr bool operator<=(nullptr_t, const unique_ptr& y); + constexpr bool operator<=(nullptr_t, const unique_ptr& y); // freestanding template - constexpr bool operator>=(const unique_ptr& x, nullptr_t); + constexpr bool operator>=(const unique_ptr& x, nullptr_t); // freestanding template - constexpr bool operator>=(nullptr_t, const unique_ptr& y); + constexpr bool operator>=(nullptr_t, const unique_ptr& y); // freestanding template requires @\libconcept{three_way_comparable}@::pointer> constexpr compare_three_way_result_t::pointer> - operator<=>(const unique_ptr& x, nullptr_t); + operator<=>(const unique_ptr& x, nullptr_t); // freestanding template basic_ostream& operator<<(basic_ostream& os, const unique_ptr& p); @@ -525,12 +536,12 @@ template class enable_shared_from_this; // \ref{util.smartptr.hash}, hash support - template struct hash; - template struct hash>; + template struct hash; // freestanding + template struct hash>; // freestanding template struct hash>; // \ref{util.smartptr.atomic}, atomic smart pointers - template struct atomic; + template struct atomic; // freestanding template struct atomic>; template struct atomic>; diff --git a/source/meta.tex b/source/meta.tex index 87836cacbe..e14e0bf049 100644 --- a/source/meta.tex +++ b/source/meta.tex @@ -154,6 +154,7 @@ \indexheader{type_traits}% % FIXME: Many index entries missing. \begin{codeblock} +// all freestanding namespace std { // \ref{meta.help}, helper class template struct integral_constant; @@ -2413,6 +2414,7 @@ \indexheader{ratio}% \begin{codeblockdigitsep} +// all freestanding namespace std { // \ref{ratio.ratio}, class template \tcode{ratio} template class ratio; diff --git a/source/ranges.tex b/source/ranges.tex index ead1940263..40041e8568 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -33,141 +33,143 @@ namespace std::ranges { inline namespace @\unspec@ { // \ref{range.access}, range access - inline constexpr @\unspec@ begin = @\unspec@; - inline constexpr @\unspec@ end = @\unspec@; - inline constexpr @\unspec@ cbegin = @\unspec@; - inline constexpr @\unspec@ cend = @\unspec@; - inline constexpr @\unspec@ rbegin = @\unspec@; - inline constexpr @\unspec@ rend = @\unspec@; - inline constexpr @\unspec@ crbegin = @\unspec@; - inline constexpr @\unspec@ crend = @\unspec@; - - inline constexpr @\unspec@ size = @\unspec@; - inline constexpr @\unspec@ ssize = @\unspec@; - inline constexpr @\unspec@ empty = @\unspec@; - inline constexpr @\unspec@ data = @\unspec@; - inline constexpr @\unspec@ cdata = @\unspec@; + inline constexpr @\unspec@ begin = @\unspec@; // freestanding + inline constexpr @\unspec@ end = @\unspec@; // freestanding + inline constexpr @\unspec@ cbegin = @\unspec@; // freestanding + inline constexpr @\unspec@ cend = @\unspec@; // freestanding + inline constexpr @\unspec@ rbegin = @\unspec@; // freestanding + inline constexpr @\unspec@ rend = @\unspec@; // freestanding + inline constexpr @\unspec@ crbegin = @\unspec@; // freestanding + inline constexpr @\unspec@ crend = @\unspec@; // freestanding + + inline constexpr @\unspec@ size = @\unspec@; // freestanding + inline constexpr @\unspec@ ssize = @\unspec@; // freestanding + inline constexpr @\unspec@ empty = @\unspec@; // freestanding + inline constexpr @\unspec@ data = @\unspec@; // freestanding + inline constexpr @\unspec@ cdata = @\unspec@; // freestanding } // \ref{range.range}, ranges template - concept range = @\seebelow@; + concept range = @\seebelow@; // freestanding template - inline constexpr bool enable_borrowed_range = false; + inline constexpr bool enable_borrowed_range = false; // freestanding template - concept borrowed_range = @\seebelow@; + concept borrowed_range = @\seebelow@; // freestanding template - using iterator_t = decltype(ranges::begin(declval())); + using iterator_t = decltype(ranges::begin(declval())); // freestanding template<@\libconcept{range}@ R> - using sentinel_t = decltype(ranges::end(declval())); + using sentinel_t = decltype(ranges::end(declval())); // freestanding template<@\libconcept{range}@ R> - using range_difference_t = iter_difference_t>; + using range_difference_t = iter_difference_t>; // freestanding template<@\libconcept{sized_range}@ R> - using range_size_t = decltype(ranges::size(declval())); + using range_size_t = decltype(ranges::size(declval())); // freestanding template<@\libconcept{range}@ R> - using range_value_t = iter_value_t>; + using range_value_t = iter_value_t>; // freestanding template<@\libconcept{range}@ R> - using range_reference_t = iter_reference_t>; + using range_reference_t = iter_reference_t>; // freestanding template<@\libconcept{range}@ R> - using range_rvalue_reference_t = iter_rvalue_reference_t>; + using range_rvalue_reference_t = iter_rvalue_reference_t>; // freestanding // \ref{range.sized}, sized ranges template - inline constexpr bool disable_sized_range = false; + inline constexpr bool disable_sized_range = false; // freestanding template - concept sized_range = @\seebelow@; + concept sized_range = @\seebelow@; // freestanding // \ref{range.view}, views template - inline constexpr bool enable_view = @\seebelow@; + inline constexpr bool enable_view = @\seebelow@; // freestanding - struct view_base {}; + struct view_base {}; // freestanding template - concept view = @\seebelow@; + concept view = @\seebelow@; // freestanding // \ref{range.refinements}, other range refinements template - concept output_range = @\seebelow@; + concept output_range = @\seebelow@; // freestanding template - concept input_range = @\seebelow@; + concept input_range = @\seebelow@; // freestanding template - concept forward_range = @\seebelow@; + concept forward_range = @\seebelow@; // freestanding template - concept bidirectional_range = @\seebelow@; + concept bidirectional_range = @\seebelow@; // freestanding template - concept random_access_range = @\seebelow@; + concept random_access_range = @\seebelow@; // freestanding template - concept contiguous_range = @\seebelow@; + concept contiguous_range = @\seebelow@; // freestanding template - concept common_range = @\seebelow@; + concept common_range = @\seebelow@; // freestanding template - concept viewable_range = @\seebelow@; + concept viewable_range = @\seebelow@; // freestanding // \ref{view.interface}, class template \tcode{view_interface} template requires is_class_v && @\libconcept{same_as}@> - class view_interface; + class view_interface; // freestanding // \ref{range.subrange}, sub-ranges - enum class subrange_kind : bool { unsized, sized }; + enum class subrange_kind : bool { unsized, sized }; // freestanding template<@\libconcept{input_or_output_iterator}@ I, @\libconcept{sentinel_for}@ S = I, subrange_kind K = @\seebelow@> requires (K == subrange_kind::sized || !@\libconcept{sized_sentinel_for}@) - class subrange; + class subrange; // freestanding template - inline constexpr bool enable_borrowed_range> = true; + inline constexpr bool enable_borrowed_range> = true; // freestanding // \ref{range.dangling}, dangling iterator handling - struct dangling; + struct dangling; // freestanding template<@\libconcept{range}@ R> - using borrowed_iterator_t = @\seebelow@; + using borrowed_iterator_t = @\seebelow@; // freestanding template<@\libconcept{range}@ R> - using borrowed_subrange_t = @\seebelow@; + using borrowed_subrange_t = @\seebelow@; // freestanding // \ref{range.utility.conv}, range conversions template requires (!@\libconcept{view}@) - constexpr C to(R&& r, Args&&... args); + constexpr C to(R&& r, Args&&... args); // freestanding template class C, @\libconcept{input_range}@ R, class... Args> - constexpr auto to(R&& r, Args&&... args); + constexpr auto to(R&& r, Args&&... args); // freestanding template requires (!@\libconcept{view}@) - constexpr auto to(Args&&... args); + constexpr auto to(Args&&... args); // freestanding template class C, class... Args> - constexpr auto to(Args&&... args); + constexpr auto to(Args&&... args); // freestanding // \ref{range.empty}, empty view template requires is_object_v - class empty_view; + class empty_view; // freestanding template - inline constexpr bool enable_borrowed_range> = true; + inline constexpr bool enable_borrowed_range> = true; // freestanding namespace views { template - inline constexpr empty_view @\libmember{empty}{views}@{}; + inline constexpr empty_view @\libmember{empty}{views}@{}; // freestanding } // \ref{range.single}, single view template<@\libconcept{copy_constructible}@ T> requires is_object_v - class single_view; + class single_view; // freestanding - namespace views { inline constexpr @\unspec@ single = @\unspec@; } + namespace views { + inline constexpr @\unspec@ single = @\unspec@; // freestanding + } template using @\exposidnc{maybe-const}@ = conditional_t; // \expos @@ -175,12 +177,14 @@ // \ref{range.iota}, iota view template<@\libconcept{weakly_incrementable}@ W, @\libconcept{semiregular}@ Bound = unreachable_sentinel_t> requires @\exposconcept{weakly-equality-comparable-with}@ && @\libconcept{copyable}@ - class iota_view; + class iota_view; // freestanding template - inline constexpr bool enable_borrowed_range> = true; + inline constexpr bool enable_borrowed_range> = true; // freestanding - namespace views { inline constexpr @\unspec@ iota = @\unspec@; } + namespace views { + inline constexpr @\unspec@ iota = @\unspec@; // freestanding + } // \ref{range.istream}, istream view template<@\libconcept{movable}@ Val, class CharT, class Traits = char_traits> @@ -196,91 +200,108 @@ // \ref{range.adaptor.object}, range adaptor objects template requires is_class_v && @\libconcept{same_as}@> - class range_adaptor_closure { }; + class range_adaptor_closure { }; // freestanding // \ref{range.all}, all view namespace views { - inline constexpr @\unspec@ all = @\unspec@; + inline constexpr @\unspec@ all = @\unspec@; // freestanding template<@\libconcept{viewable_range}@ R> - using all_t = decltype(all(declval())); + using all_t = decltype(all(declval())); // freestanding } // \ref{range.ref.view}, ref view template<@\libconcept{range}@ R> requires is_object_v - class ref_view; + class ref_view; // freestanding template - inline constexpr bool enable_borrowed_range> = true; + inline constexpr bool enable_borrowed_range> = true; // freestanding // \ref{range.owning.view}, owning view template<@\libconcept{range}@ R> requires @\seebelow@ - class owning_view; + class owning_view; // freestanding template - inline constexpr bool enable_borrowed_range> = enable_borrowed_range; + inline constexpr bool enable_borrowed_range> = // freestanding + enable_borrowed_range; // \ref{range.filter}, filter view template<@\libconcept{input_range}@ V, @\libconcept{indirect_unary_predicate}@> Pred> requires @\libconcept{view}@ && is_object_v - class filter_view; + class filter_view; // freestanding - namespace views { inline constexpr @\unspec@ filter = @\unspec@; } + namespace views { + inline constexpr @\unspec@ filter = @\unspec@; // freestanding + } // \ref{range.transform}, transform view template<@\libconcept{input_range}@ V, @\libconcept{copy_constructible}@ F> requires @\libconcept{view}@ && is_object_v && @\libconcept{regular_invocable}@> && @\exposconcept{can-reference}@>> - class transform_view; + class transform_view; // freestanding - namespace views { inline constexpr @\unspec@ transform = @\unspec@; } + namespace views { + inline constexpr @\unspec@ transform = @\unspec@; // freestanding + } // \ref{range.take}, take view - template<@\libconcept{view}@> class take_view; + template<@\libconcept{view}@> class take_view; // freestanding template - inline constexpr bool enable_borrowed_range> = enable_borrowed_range; + inline constexpr bool enable_borrowed_range> = // freestanding + enable_borrowed_range; - namespace views { inline constexpr @\unspec@ take = @\unspec@; } + namespace views { + inline constexpr @\unspec@ take = @\unspec@; // freestanding + } // \ref{range.take.while}, take while view template<@\libconcept{view}@ V, class Pred> requires @\libconcept{input_range}@ && is_object_v && @\libconcept{indirect_unary_predicate}@> - class take_while_view; + class take_while_view; // freestanding - namespace views { inline constexpr @\unspec@ take_while = @\unspec@; } + namespace views { + inline constexpr @\unspec@ take_while = @\unspec@; // freestanding + } // \ref{range.drop}, drop view template<@\libconcept{view}@ V> - class drop_view; + class drop_view; // freestanding template - inline constexpr bool enable_borrowed_range> = enable_borrowed_range; + inline constexpr bool enable_borrowed_range> = // freestanding + enable_borrowed_range; - namespace views { inline constexpr @\unspec@ drop = @\unspec@; } + namespace views { + inline constexpr @\unspec@ drop = @\unspec@; // freestanding + } // \ref{range.drop.while}, drop while view template<@\libconcept{view}@ V, class Pred> requires @\libconcept{input_range}@ && is_object_v && @\libconcept{indirect_unary_predicate}@> - class drop_while_view; + class drop_while_view; // freestanding template - inline constexpr bool enable_borrowed_range> = + inline constexpr bool enable_borrowed_range> = // freestanding enable_borrowed_range; - namespace views { inline constexpr @\unspec@ drop_while = @\unspec@; } + namespace views { + inline constexpr @\unspec@ drop_while = @\unspec@; // freestanding + } // \ref{range.join}, join view template<@\libconcept{input_range}@ V> requires @\libconcept{view}@ && @\libconcept{input_range}@> - class join_view; + class join_view; // freestanding - namespace views { inline constexpr @\unspec@ join = @\unspec@; } + namespace views { + inline constexpr @\unspec@ join = @\unspec@; // freestanding + } // \ref{range.join.with}, join with view template @@ -290,9 +311,11 @@ requires @\libconcept{view}@ && @\libconcept{input_range}@> && @\libconcept{view}@ && @\exposconcept{compatible-joinable-ranges}@, Pattern> - class join_with_view; + class join_with_view; // freestanding - namespace views { inline constexpr @\unspec@ join_with = @\unspec@; } + namespace views { + inline constexpr @\unspec@ join_with = @\unspec@; // freestanding + } // \ref{range.lazy.split}, lazy split view template @@ -302,170 +325,191 @@ requires @\libconcept{view}@ && @\libconcept{view}@ && @\libconcept{indirectly_comparable}@, iterator_t, ranges::equal_to> && (@\libconcept{forward_range}@ || @\exposconcept{tiny-range}@) - class lazy_split_view; + class lazy_split_view; // freestanding // \ref{range.split}, split view template<@\libconcept{forward_range}@ V, @\libconcept{forward_range}@ Pattern> requires @\libconcept{view}@ && @\libconcept{view}@ && @\libconcept{indirectly_comparable}@, iterator_t, ranges::equal_to> - class split_view; + class split_view; // freestanding namespace views { - inline constexpr @\unspec@ lazy_split = @\unspec@; - inline constexpr @\unspec@ split = @\unspec@; + inline constexpr @\unspec@ lazy_split = @\unspec@; // freestanding + inline constexpr @\unspec@ split = @\unspec@; // freestanding } // \ref{range.counted}, counted view - namespace views { inline constexpr @\unspec@ counted = @\unspec@; } + namespace views { + inline constexpr @\unspec@ counted = @\unspec@; // freestanding + } // \ref{range.common}, common view template<@\libconcept{view}@ V> requires (!@\libconcept{common_range}@ && @\libconcept{copyable}@>) - class common_view; + class common_view; // freestanding template - inline constexpr bool enable_borrowed_range> = enable_borrowed_range; + inline constexpr bool enable_borrowed_range> = // freestanding + enable_borrowed_range; - namespace views { inline constexpr @\unspec@ common = @\unspec@; } + namespace views { + inline constexpr @\unspec@ common = @\unspec@; // freestanding + } // \ref{range.reverse}, reverse view template<@\libconcept{view}@ V> requires @\libconcept{bidirectional_range}@ - class reverse_view; + class reverse_view; // freestanding template - inline constexpr bool enable_borrowed_range> = enable_borrowed_range; + inline constexpr bool enable_borrowed_range> = // freestanding + enable_borrowed_range; - namespace views { inline constexpr @\unspec@ reverse = @\unspec@; } + namespace views { + inline constexpr @\unspec@ reverse = @\unspec@; // freestanding + } // \ref{range.elements}, elements view template<@\libconcept{input_range}@ V, size_t N> requires @\seebelow@ - class elements_view; + class elements_view; // freestanding template - inline constexpr bool enable_borrowed_range> = enable_borrowed_range; + inline constexpr bool enable_borrowed_range> = // freestanding + enable_borrowed_range; template - using @\libglobal{keys_view}@ = elements_view; + using @\libglobal{keys_view}@ = elements_view; // freestanding template - using @\libglobal{values_view}@ = elements_view; + using @\libglobal{values_view}@ = elements_view; // freestanding namespace views { template - inline constexpr @\unspec@ elements = @\unspec@; - inline constexpr auto @\libmember{keys}{views}@ = elements<0>; - inline constexpr auto @\libmember{values}{views}@ = elements<1>; + inline constexpr @\unspec@ elements = @\unspec@; // freestanding + inline constexpr auto @\libmember{keys}{views}@ = elements<0>; // freestanding + inline constexpr auto @\libmember{values}{views}@ = elements<1>; // freestanding } // \ref{range.zip}, zip view template<@\libconcept{input_range}@... Views> requires (@\libconcept{view}@ && ...) && (sizeof...(Views) > 0) - class zip_view; + class zip_view; // freestanding template - inline constexpr bool enable_borrowed_range> = + inline constexpr bool enable_borrowed_range> = // freestanding (enable_borrowed_range && ...); - namespace views { inline constexpr @\unspec@ zip = @\unspec@; } + namespace views { + inline constexpr @\unspec@ zip = @\unspec@; // freestanding + } // \ref{range.zip.transform}, zip transform view template<@\libconcept{copy_constructible}@ F, @\libconcept{input_range}@... Views> requires (@\libconcept{view}@ && ...) && (sizeof...(Views) > 0) && is_object_v && @\libconcept{regular_invocable}@...> && @\exposconcept{can-reference}@...>> - class zip_transform_view; + class zip_transform_view; // freestanding - namespace views { inline constexpr @\unspec@ zip_transform = @\unspec@; } + namespace views { + inline constexpr @\unspec@ zip_transform = @\unspec@; // freestanding + } // \ref{range.adjacent}, adjacent view template<@\libconcept{forward_range}@ V, size_t N> requires @\libconcept{view}@ && (N > 0) - class adjacent_view; + class adjacent_view; // freestanding template - inline constexpr bool enable_borrowed_range> = + inline constexpr bool enable_borrowed_range> = // freestanding enable_borrowed_range; namespace views { template - inline constexpr @\unspec@ adjacent = @\unspec@ ; - inline constexpr auto @\libmember{pairwise}{views}@ = adjacent<2>; + inline constexpr @\unspec@ adjacent = @\unspec@ ; // freestanding + inline constexpr auto @\libmember{pairwise}{views}@ = adjacent<2>; // freestanding } // \ref{range.adjacent.transform}, adjacent transform view template<@\libconcept{forward_range}@ V, @\libconcept{copy_constructible}@ F, size_t N> requires @\seebelow@ - class adjacent_transform_view; + class adjacent_transform_view; // freestanding namespace views { template - inline constexpr @\unspec@ adjacent_transform = @\unspec@; - inline constexpr auto @\libmember{pairwise_transform}{views}@ = adjacent_transform<2>; + inline constexpr @\unspec@ adjacent_transform = @\unspec@; // freestanding + inline constexpr auto @\libmember{pairwise_transform}{views}@ = adjacent_transform<2>; // freestanding } // \ref{range.chunk}, chunk view template<@\libconcept{view}@ V> requires @\libconcept{input_range}@ - class chunk_view; + class chunk_view; // freestanding template<@\libconcept{view}@ V> requires @\libconcept{forward_range}@ - class chunk_view; + class chunk_view; // freestanding template - inline constexpr bool enable_borrowed_range> = + inline constexpr bool enable_borrowed_range> = // freestanding @\libconcept{forward_range}@ && enable_borrowed_range; - namespace views { inline constexpr @\unspec@ chunk = @\unspec@; } + namespace views { + inline constexpr @\unspec@ chunk = @\unspec@; // freestanding + } // \ref{range.slide}, slide view template<@\libconcept{forward_range}@ V> requires @\libconcept{view}@ - class slide_view; + class slide_view; // freestanding template inline constexpr bool enable_borrowed_range> = - enable_borrowed_range; + enable_borrowed_range; // freestanding - namespace views { inline constexpr @\unspec@ slide = @\unspec@; } + namespace views { + inline constexpr @\unspec@ slide = @\unspec@; // freestanding + } // \ref{range.chunk.by}, chunk by view template<@\libconcept{forward_range}@ V, @\libconcept{indirect_binary_predicate}@, iterator_t> Pred> requires @\libconcept{view}@ && is_object_v - class chunk_by_view; + class chunk_by_view; // freestanding - namespace views { inline constexpr @\unspec@ chunk_by = @\unspec@; } + namespace views { // freestanding + inline constexpr @\unspec@ chunk_by = @\unspec@; // freestanding + } } namespace std { - namespace views = ranges::views; + namespace views = ranges::views; // freestanding - template struct tuple_size; - template struct tuple_element; + template struct tuple_size; // freestanding + template struct tuple_element; // freestanding template - struct tuple_size> + struct tuple_size> // freestanding : integral_constant {}; template - struct tuple_element<0, ranges::subrange> { - using type = I; + struct tuple_element<0, ranges::subrange> { // freestanding + using type = I; // freestanding }; template - struct tuple_element<1, ranges::subrange> { - using type = S; + struct tuple_element<1, ranges::subrange> { // freestanding + using type = S; // freestanding }; template - struct tuple_element<0, const ranges::subrange> { - using type = I; + struct tuple_element<0, const ranges::subrange> { // freestanding + using type = I; // freestanding }; template - struct tuple_element<1, const ranges::subrange> { - using type = S; + struct tuple_element<1, const ranges::subrange> { // freestanding + using type = S; // freestanding }; - struct from_range_t { explicit from_range_t() = default; }; - inline constexpr from_range_t from_range{}; + struct from_range_t { // freestanding + explicit from_range_t() = default; // freestanding + }; + inline constexpr from_range_t from_range{}; // freestanding } \end{codeblock} diff --git a/source/support.tex b/source/support.tex index 181fdf754f..6cd1d6d08b 100644 --- a/source/support.tex +++ b/source/support.tex @@ -52,6 +52,7 @@ \indexlibraryglobal{nullptr_t}% \indexlibraryglobal{byte}% \begin{codeblock} +// all freestanding namespace std { using ptrdiff_t = @\seebelow@; using size_t = @\seebelow@; @@ -149,13 +150,13 @@ \indexlibraryglobal{wctomb}% \begin{codeblock} namespace std { - using size_t = @\seebelow@; + using size_t = @\seebelow@; // freestanding using div_t = @\seebelow@; using ldiv_t = @\seebelow@; using lldiv_t = @\seebelow@; } -#define NULL @\seebelow@ +#define NULL @\seebelow@ // freestanding #define EXIT_FAILURE @\seebelow@ #define EXIT_SUCCESS @\seebelow@ #define RAND_MAX @\seebelow@ @@ -163,20 +164,20 @@ namespace std { // Exposition-only function type aliases - extern "C" using @\placeholdernc{c-atexit-handler}@ = void(); // \expos - extern "C++" using @\placeholdernc{atexit-handler}@ = void(); // \expos - extern "C" using @\placeholdernc{c-compare-pred}@ = int(const void*, const void*); // \expos - extern "C++" using @\placeholdernc{compare-pred}@ = int(const void*, const void*); // \expos + extern "C" using @\placeholdernc{c-atexit-handler}@ = void(); // \expos + extern "C++" using @\placeholdernc{atexit-handler}@ = void(); // \expos + extern "C" using @\placeholdernc{c-compare-pred}@ = int(const void*, const void*); // \expos + extern "C++" using @\placeholdernc{compare-pred}@ = int(const void*, const void*); // \expos // \ref{support.start.term}, start and termination - [[noreturn]] void abort() noexcept; - int atexit(@\placeholder{c-atexit-handler}@* func) noexcept; - int atexit(@\placeholder{atexit-handler}@* func) noexcept; - int at_quick_exit(@\placeholder{c-atexit-handler}@* func) noexcept; - int at_quick_exit(@\placeholder{atexit-handler}@* func) noexcept; - [[noreturn]] void exit(int status); - [[noreturn]] void _Exit(int status) noexcept; - [[noreturn]] void quick_exit(int status) noexcept; + [[noreturn]] void abort() noexcept; // freestanding + int atexit(@\placeholder{c-atexit-handler}@* func) noexcept; // freestanding + int atexit(@\placeholder{atexit-handler}@* func) noexcept; // freestanding + int at_quick_exit(@\placeholder{c-atexit-handler}@* func) noexcept; // freestanding + int at_quick_exit(@\placeholder{atexit-handler}@* func) noexcept; // freestanding + [[noreturn]] void exit(int status); // freestanding + [[noreturn]] void _Exit(int status) noexcept; // freestanding + [[noreturn]] void quick_exit(int status) noexcept; // freestanding char* getenv(const char* name); int system(const char* string); @@ -550,6 +551,7 @@ \end{note} \begin{codeblock} +// all freestanding #define @\defnlibxname{cpp_lib_addressof_constexpr}@ 201603L // also in \libheader{memory} #define @\defnlibxname{cpp_lib_allocate_at_least}@ 202106L // also in \libheader{memory} #define @\defnlibxname{cpp_lib_allocator_traits_is_always_equal}@ 201411L @@ -735,6 +737,7 @@ \indexlibraryglobal{float_denorm_style}% \begin{codeblock} +// all freestanding namespace std { // \ref{fp.style}, floating-point type properties enum float_round_style; @@ -1696,6 +1699,7 @@ \indexlibraryglobal{LLONG_MAX}% \indexlibraryglobal{ULLONG_MAX}% \begin{codeblock} +// all freestanding #define CHAR_BIT @\seebelow@ #define SCHAR_MIN @\seebelow@ #define SCHAR_MAX @\seebelow@ @@ -1771,6 +1775,7 @@ \indexlibraryglobal{LDBL_MIN_EXP}% \indexlibraryglobal{LDBL_TRUE_MIN}% \begin{codeblock} +// all freestanding #define FLT_ROUNDS @\seebelow@ #define FLT_EVAL_METHOD @\seebelow@ #define FLT_HAS_SUBNORM @\seebelow@ @@ -1861,6 +1866,7 @@ \indexlibraryglobal{uintmax_t}% \indexlibraryglobal{uintptr_t}% \begin{codeblock} +// all freestanding namespace std { using int8_t = @\textit{signed integer type}@; // optional using int16_t = @\textit{signed integer type}@; // optional @@ -2218,6 +2224,7 @@ \rSec2[new.syn]{Header \tcode{} synopsis} \begin{codeblock} +// all freestanding namespace std { // \ref{alloc.errors}, storage allocation errors class bad_alloc; @@ -3151,6 +3158,7 @@ \indexlibraryglobal{bad_cast}% \indexlibraryglobal{bad_typeid}% \begin{codeblock} +// all freestanding namespace std { class type_info; class bad_cast; @@ -3335,6 +3343,7 @@ that provides a means to obtain source location information. \begin{codeblock} +// all freestanding namespace std { struct source_location; } @@ -3560,6 +3569,7 @@ \rSec2[exception.syn]{Header \tcode{} synopsis} \begin{codeblock} +// all freestanding namespace std { class exception; class bad_exception; @@ -4072,6 +4082,7 @@ \indexlibraryglobal{end}% \begin{codeblock} +// all freestanding namespace std { template class initializer_list { public: @@ -4207,6 +4218,7 @@ \indexlibraryglobal{is_gteq}% \indexlibraryglobal{common_comparison_category_t}% \begin{codeblock} +// all freestanding namespace std { // \ref{cmp.categories}, comparison category types class partial_ordering; @@ -5111,6 +5123,7 @@ \begin{codeblock} #include // see \ref{compare.syn} +// all freestanding namespace std { // \ref{coroutine.traits}, coroutine traits template @@ -5734,6 +5747,7 @@ \indexlibraryglobal{va_end}% \indexlibraryglobal{va_arg}% \begin{codeblock} +// all freestanding namespace std { using va_list = @\seebelow@; } diff --git a/source/threads.tex b/source/threads.tex index 020915bf95..9ce34c9939 100644 --- a/source/threads.tex +++ b/source/threads.tex @@ -2048,261 +2048,278 @@ \begin{codeblock} namespace std { // \ref{atomics.order}, order and consistency - enum class memory_order : @\unspec@; + enum class memory_order : @\unspec@; // freestanding template - T kill_dependency(T y) noexcept; + T kill_dependency(T y) noexcept; // freestanding } // \ref{atomics.lockfree}, lock-free property -#define ATOMIC_BOOL_LOCK_FREE @\unspec@ -#define ATOMIC_CHAR_LOCK_FREE @\unspec@ -#define ATOMIC_CHAR8_T_LOCK_FREE @\unspec@ -#define ATOMIC_CHAR16_T_LOCK_FREE @\unspec@ -#define ATOMIC_CHAR32_T_LOCK_FREE @\unspec@ -#define ATOMIC_WCHAR_T_LOCK_FREE @\unspec@ -#define ATOMIC_SHORT_LOCK_FREE @\unspec@ -#define ATOMIC_INT_LOCK_FREE @\unspec@ -#define ATOMIC_LONG_LOCK_FREE @\unspec@ -#define ATOMIC_LLONG_LOCK_FREE @\unspec@ -#define ATOMIC_POINTER_LOCK_FREE @\unspec@ +#define ATOMIC_BOOL_LOCK_FREE @\unspecnc@ // freestanding +#define ATOMIC_CHAR_LOCK_FREE @\unspecnc@ // freestanding +#define ATOMIC_CHAR8_T_LOCK_FREE @\unspecnc@ // freestanding +#define ATOMIC_CHAR16_T_LOCK_FREE @\unspecnc@ // freestanding +#define ATOMIC_CHAR32_T_LOCK_FREE @\unspecnc@ // freestanding +#define ATOMIC_WCHAR_T_LOCK_FREE @\unspecnc@ // freestanding +#define ATOMIC_SHORT_LOCK_FREE @\unspecnc@ // freestanding +#define ATOMIC_INT_LOCK_FREE @\unspecnc@ // freestanding +#define ATOMIC_LONG_LOCK_FREE @\unspecnc@ // freestanding +#define ATOMIC_LLONG_LOCK_FREE @\unspecnc@ // freestanding +#define ATOMIC_POINTER_LOCK_FREE @\unspecnc@ // freestanding namespace std { // \ref{atomics.ref.generic}, class template \tcode{atomic_ref} - template struct atomic_ref; + template struct atomic_ref; // freestanding // \ref{atomics.ref.pointer}, partial specialization for pointers - template struct atomic_ref; + template struct atomic_ref; // freestanding // \ref{atomics.types.generic}, class template \tcode{atomic} - template struct atomic; + template struct atomic; // freestanding // \ref{atomics.types.pointer}, partial specialization for pointers - template struct atomic; + template struct atomic; // freestanding // \ref{atomics.nonmembers}, non-member functions template - bool atomic_is_lock_free(const volatile atomic*) noexcept; + bool atomic_is_lock_free(const volatile atomic*) noexcept; // freestanding template - bool atomic_is_lock_free(const atomic*) noexcept; + bool atomic_is_lock_free(const atomic*) noexcept; // freestanding template - void atomic_store(volatile atomic*, typename atomic::value_type) noexcept; + void atomic_store(volatile atomic*, // freestanding + typename atomic::value_type) noexcept; template - void atomic_store(atomic*, typename atomic::value_type) noexcept; + void atomic_store(atomic*, typename atomic::value_type) noexcept; // freestanding template - void atomic_store_explicit(volatile atomic*, typename atomic::value_type, + void atomic_store_explicit(volatile atomic*, // freestanding + typename atomic::value_type, memory_order) noexcept; template - void atomic_store_explicit(atomic*, typename atomic::value_type, + void atomic_store_explicit(atomic*, typename atomic::value_type, // freestanding memory_order) noexcept; template - T atomic_load(const volatile atomic*) noexcept; + T atomic_load(const volatile atomic*) noexcept; // freestanding template - T atomic_load(const atomic*) noexcept; + T atomic_load(const atomic*) noexcept; // freestanding template - T atomic_load_explicit(const volatile atomic*, memory_order) noexcept; + T atomic_load_explicit(const volatile atomic*, memory_order) noexcept; // freestanding template - T atomic_load_explicit(const atomic*, memory_order) noexcept; + T atomic_load_explicit(const atomic*, memory_order) noexcept; // freestanding template - T atomic_exchange(volatile atomic*, typename atomic::value_type) noexcept; + T atomic_exchange(volatile atomic*, // freestanding + typename atomic::value_type) noexcept; template - T atomic_exchange(atomic*, typename atomic::value_type) noexcept; + T atomic_exchange(atomic*, typename atomic::value_type) noexcept; // freestanding template - T atomic_exchange_explicit(volatile atomic*, typename atomic::value_type, + T atomic_exchange_explicit(volatile atomic*, // freestanding + typename atomic::value_type, memory_order) noexcept; template - T atomic_exchange_explicit(atomic*, typename atomic::value_type, + T atomic_exchange_explicit(atomic*, typename atomic::value_type, // freestanding memory_order) noexcept; template - bool atomic_compare_exchange_weak(volatile atomic*, + bool atomic_compare_exchange_weak(volatile atomic*, // freestanding typename atomic::value_type*, typename atomic::value_type) noexcept; template - bool atomic_compare_exchange_weak(atomic*, + bool atomic_compare_exchange_weak(atomic*, // freestanding typename atomic::value_type*, typename atomic::value_type) noexcept; template - bool atomic_compare_exchange_strong(volatile atomic*, + bool atomic_compare_exchange_strong(volatile atomic*, // freestanding typename atomic::value_type*, typename atomic::value_type) noexcept; template - bool atomic_compare_exchange_strong(atomic*, + bool atomic_compare_exchange_strong(atomic*, // freestanding typename atomic::value_type*, typename atomic::value_type) noexcept; template - bool atomic_compare_exchange_weak_explicit(volatile atomic*, + bool atomic_compare_exchange_weak_explicit(volatile atomic*, // freestanding typename atomic::value_type*, typename atomic::value_type, memory_order, memory_order) noexcept; template - bool atomic_compare_exchange_weak_explicit(atomic*, + bool atomic_compare_exchange_weak_explicit(atomic*, // freestanding typename atomic::value_type*, typename atomic::value_type, memory_order, memory_order) noexcept; template - bool atomic_compare_exchange_strong_explicit(volatile atomic*, + bool atomic_compare_exchange_strong_explicit(volatile atomic*, // freestanding typename atomic::value_type*, typename atomic::value_type, memory_order, memory_order) noexcept; template - bool atomic_compare_exchange_strong_explicit(atomic*, + bool atomic_compare_exchange_strong_explicit(atomic*, // freestanding typename atomic::value_type*, typename atomic::value_type, memory_order, memory_order) noexcept; template - T atomic_fetch_add(volatile atomic*, typename atomic::difference_type) noexcept; + T atomic_fetch_add(volatile atomic*, // freestanding + typename atomic::difference_type) noexcept; template - T atomic_fetch_add(atomic*, typename atomic::difference_type) noexcept; + T atomic_fetch_add(atomic*, typename atomic::difference_type) noexcept; // freestanding template - T atomic_fetch_add_explicit(volatile atomic*, typename atomic::difference_type, + T atomic_fetch_add_explicit(volatile atomic*, // freestanding + typename atomic::difference_type, memory_order) noexcept; template - T atomic_fetch_add_explicit(atomic*, typename atomic::difference_type, + T atomic_fetch_add_explicit(atomic*, typename atomic::difference_type, // freestanding memory_order) noexcept; template - T atomic_fetch_sub(volatile atomic*, typename atomic::difference_type) noexcept; + T atomic_fetch_sub(volatile atomic*, // freestanding + typename atomic::difference_type) noexcept; template - T atomic_fetch_sub(atomic*, typename atomic::difference_type) noexcept; + T atomic_fetch_sub(atomic*, typename atomic::difference_type) noexcept; // freestanding template - T atomic_fetch_sub_explicit(volatile atomic*, typename atomic::difference_type, + T atomic_fetch_sub_explicit(volatile atomic*, // freestanding + typename atomic::difference_type, memory_order) noexcept; template - T atomic_fetch_sub_explicit(atomic*, typename atomic::difference_type, + T atomic_fetch_sub_explicit(atomic*, typename atomic::difference_type, // freestanding memory_order) noexcept; template - T atomic_fetch_and(volatile atomic*, typename atomic::value_type) noexcept; + T atomic_fetch_and(volatile atomic*, // freestanding + typename atomic::value_type) noexcept; template - T atomic_fetch_and(atomic*, typename atomic::value_type) noexcept; + T atomic_fetch_and(atomic*, typename atomic::value_type) noexcept; // freestanding template - T atomic_fetch_and_explicit(volatile atomic*, typename atomic::value_type, + T atomic_fetch_and_explicit(volatile atomic*, // freestanding + typename atomic::value_type, memory_order) noexcept; template - T atomic_fetch_and_explicit(atomic*, typename atomic::value_type, + T atomic_fetch_and_explicit(atomic*, typename atomic::value_type, // freestanding memory_order) noexcept; template - T atomic_fetch_or(volatile atomic*, typename atomic::value_type) noexcept; + T atomic_fetch_or(volatile atomic*, // freestanding + typename atomic::value_type) noexcept; template - T atomic_fetch_or(atomic*, typename atomic::value_type) noexcept; + T atomic_fetch_or(atomic*, typename atomic::value_type) noexcept; // freestanding template - T atomic_fetch_or_explicit(volatile atomic*, typename atomic::value_type, + T atomic_fetch_or_explicit(volatile atomic*, // freestanding + typename atomic::value_type, memory_order) noexcept; template - T atomic_fetch_or_explicit(atomic*, typename atomic::value_type, + T atomic_fetch_or_explicit(atomic*, typename atomic::value_type, // freestanding memory_order) noexcept; template - T atomic_fetch_xor(volatile atomic*, typename atomic::value_type) noexcept; + T atomic_fetch_xor(volatile atomic*, // freestanding + typename atomic::value_type) noexcept; template - T atomic_fetch_xor(atomic*, typename atomic::value_type) noexcept; + T atomic_fetch_xor(atomic*, typename atomic::value_type) noexcept; // freestanding template - T atomic_fetch_xor_explicit(volatile atomic*, typename atomic::value_type, + T atomic_fetch_xor_explicit(volatile atomic*, // freestanding + typename atomic::value_type, memory_order) noexcept; template - T atomic_fetch_xor_explicit(atomic*, typename atomic::value_type, + T atomic_fetch_xor_explicit(atomic*, typename atomic::value_type, // freestanding memory_order) noexcept; template - void atomic_wait(const volatile atomic*, typename atomic::value_type); + void atomic_wait(const volatile atomic*, typename atomic::value_type); // freestanding template - void atomic_wait(const atomic*, typename atomic::value_type); + void atomic_wait(const atomic*, typename atomic::value_type); // freestanding template - void atomic_wait_explicit(const volatile atomic*, typename atomic::value_type, + void atomic_wait_explicit(const volatile atomic*, // freestanding + typename atomic::value_type, memory_order); template - void atomic_wait_explicit(const atomic*, typename atomic::value_type, + void atomic_wait_explicit(const atomic*, typename atomic::value_type, // freestanding memory_order); template - void atomic_notify_one(volatile atomic*); + void atomic_notify_one(volatile atomic*); // freestanding template - void atomic_notify_one(atomic*); + void atomic_notify_one(atomic*); // freestanding template - void atomic_notify_all(volatile atomic*); + void atomic_notify_all(volatile atomic*); // freestanding template - void atomic_notify_all(atomic*); + void atomic_notify_all(atomic*); // freestanding // \ref{atomics.alias}, type aliases - using atomic_bool = atomic; - using atomic_char = atomic; - using atomic_schar = atomic; - using atomic_uchar = atomic; - using atomic_short = atomic; - using atomic_ushort = atomic; - using atomic_int = atomic; - using atomic_uint = atomic; - using atomic_long = atomic; - using atomic_ulong = atomic; - using atomic_llong = atomic; - using atomic_ullong = atomic; - using atomic_char8_t = atomic; - using atomic_char16_t = atomic; - using atomic_char32_t = atomic; - using atomic_wchar_t = atomic; - - using atomic_int8_t = atomic; - using atomic_uint8_t = atomic; - using atomic_int16_t = atomic; - using atomic_uint16_t = atomic; - using atomic_int32_t = atomic; - using atomic_uint32_t = atomic; - using atomic_int64_t = atomic; - using atomic_uint64_t = atomic; - - using atomic_int_least8_t = atomic; - using atomic_uint_least8_t = atomic; - using atomic_int_least16_t = atomic; - using atomic_uint_least16_t = atomic; - using atomic_int_least32_t = atomic; - using atomic_uint_least32_t = atomic; - using atomic_int_least64_t = atomic; - using atomic_uint_least64_t = atomic; - - using atomic_int_fast8_t = atomic; - using atomic_uint_fast8_t = atomic; - using atomic_int_fast16_t = atomic; - using atomic_uint_fast16_t = atomic; - using atomic_int_fast32_t = atomic; - using atomic_uint_fast32_t = atomic; - using atomic_int_fast64_t = atomic; - using atomic_uint_fast64_t = atomic; - - using atomic_intptr_t = atomic; - using atomic_uintptr_t = atomic; - using atomic_size_t = atomic; - using atomic_ptrdiff_t = atomic; - using atomic_intmax_t = atomic; - using atomic_uintmax_t = atomic; + using atomic_bool = atomic; // freestanding + using atomic_char = atomic; // freestanding + using atomic_schar = atomic; // freestanding + using atomic_uchar = atomic; // freestanding + using atomic_short = atomic; // freestanding + using atomic_ushort = atomic; // freestanding + using atomic_int = atomic; // freestanding + using atomic_uint = atomic; // freestanding + using atomic_long = atomic; // freestanding + using atomic_ulong = atomic; // freestanding + using atomic_llong = atomic; // freestanding + using atomic_ullong = atomic; // freestanding + using atomic_char8_t = atomic; // freestanding + using atomic_char16_t = atomic; // freestanding + using atomic_char32_t = atomic; // freestanding + using atomic_wchar_t = atomic; // freestanding + + using atomic_int8_t = atomic; // freestanding + using atomic_uint8_t = atomic; // freestanding + using atomic_int16_t = atomic; // freestanding + using atomic_uint16_t = atomic; // freestanding + using atomic_int32_t = atomic; // freestanding + using atomic_uint32_t = atomic; // freestanding + using atomic_int64_t = atomic; // freestanding + using atomic_uint64_t = atomic; // freestanding + + using atomic_int_least8_t = atomic; // freestanding + using atomic_uint_least8_t = atomic; // freestanding + using atomic_int_least16_t = atomic; // freestanding + using atomic_uint_least16_t = atomic; // freestanding + using atomic_int_least32_t = atomic; // freestanding + using atomic_uint_least32_t = atomic; // freestanding + using atomic_int_least64_t = atomic; // freestanding + using atomic_uint_least64_t = atomic; // freestanding + + using atomic_int_fast8_t = atomic; // freestanding + using atomic_uint_fast8_t = atomic; // freestanding + using atomic_int_fast16_t = atomic; // freestanding + using atomic_uint_fast16_t = atomic; // freestanding + using atomic_int_fast32_t = atomic; // freestanding + using atomic_uint_fast32_t = atomic; // freestanding + using atomic_int_fast64_t = atomic; // freestanding + using atomic_uint_fast64_t = atomic; // freestanding + + using atomic_intptr_t = atomic; // freestanding + using atomic_uintptr_t = atomic; // freestanding + using atomic_size_t = atomic; // freestanding + using atomic_ptrdiff_t = atomic; // freestanding + using atomic_intmax_t = atomic; // freestanding + using atomic_uintmax_t = atomic; // freestanding using atomic_signed_lock_free = @\seebelow@; using atomic_unsigned_lock_free = @\seebelow@; // \ref{atomics.flag}, flag type and operations - struct atomic_flag; - - bool atomic_flag_test(const volatile atomic_flag*) noexcept; - bool atomic_flag_test(const atomic_flag*) noexcept; - bool atomic_flag_test_explicit(const volatile atomic_flag*, memory_order) noexcept; - bool atomic_flag_test_explicit(const atomic_flag*, memory_order) noexcept; - bool atomic_flag_test_and_set(volatile atomic_flag*) noexcept; - bool atomic_flag_test_and_set(atomic_flag*) noexcept; - bool atomic_flag_test_and_set_explicit(volatile atomic_flag*, memory_order) noexcept; - bool atomic_flag_test_and_set_explicit(atomic_flag*, memory_order) noexcept; - void atomic_flag_clear(volatile atomic_flag*) noexcept; - void atomic_flag_clear(atomic_flag*) noexcept; - void atomic_flag_clear_explicit(volatile atomic_flag*, memory_order) noexcept; - void atomic_flag_clear_explicit(atomic_flag*, memory_order) noexcept; - - void atomic_flag_wait(const volatile atomic_flag*, bool) noexcept; - void atomic_flag_wait(const atomic_flag*, bool) noexcept; - void atomic_flag_wait_explicit(const volatile atomic_flag*, + struct atomic_flag; // freestanding + + bool atomic_flag_test(const volatile atomic_flag*) noexcept; // freestanding + bool atomic_flag_test(const atomic_flag*) noexcept; // freestanding + bool atomic_flag_test_explicit(const volatile atomic_flag*, // freestanding + memory_order) noexcept; + bool atomic_flag_test_explicit(const atomic_flag*, memory_order) noexcept; // freestanding + bool atomic_flag_test_and_set(volatile atomic_flag*) noexcept; // freestanding + bool atomic_flag_test_and_set(atomic_flag*) noexcept; // freestanding + bool atomic_flag_test_and_set_explicit(volatile atomic_flag*, // freestanding + memory_order) noexcept; + bool atomic_flag_test_and_set_explicit(atomic_flag*, memory_order) noexcept; // freestanding + void atomic_flag_clear(volatile atomic_flag*) noexcept; // freestanding + void atomic_flag_clear(atomic_flag*) noexcept; // freestanding + void atomic_flag_clear_explicit(volatile atomic_flag*, memory_order) noexcept; // freestanding + void atomic_flag_clear_explicit(atomic_flag*, memory_order) noexcept; // freestanding + + void atomic_flag_wait(const volatile atomic_flag*, bool) noexcept; // freestanding + void atomic_flag_wait(const atomic_flag*, bool) noexcept; // freestanding + void atomic_flag_wait_explicit(const volatile atomic_flag*, // freestanding bool, memory_order) noexcept; - void atomic_flag_wait_explicit(const atomic_flag*, + void atomic_flag_wait_explicit(const atomic_flag*, // freestanding bool, memory_order) noexcept; - void atomic_flag_notify_one(volatile atomic_flag*) noexcept; - 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@ + void atomic_flag_notify_one(volatile atomic_flag*) noexcept; // freestanding + void atomic_flag_notify_one(atomic_flag*) noexcept; // freestanding + void atomic_flag_notify_all(volatile atomic_flag*) noexcept; // freestanding + void atomic_flag_notify_all(atomic_flag*) noexcept; // freestanding + #define ATOMIC_FLAG_INIT @\seebelownc@ // freestanding // \ref{atomics.fences}, fences - extern "C" void atomic_thread_fence(memory_order) noexcept; - extern "C" void atomic_signal_fence(memory_order) noexcept; + extern "C" void atomic_thread_fence(memory_order) noexcept; // freestanding + extern "C" void atomic_signal_fence(memory_order) noexcept; // freestanding } \end{codeblock} @@ -2638,14 +2655,11 @@ value of 2 indicates that the types are always lock-free. \pnum -At least one signed integral specialization of the \tcode{atomic} template, +On a hosted implementation\iref{compliance}, +at least one signed integral specialization of the \tcode{atomic} template, along with the specialization for the corresponding unsigned type\iref{basic.fundamental}, is always lock-free. -\begin{note} -\indextext{implementation!freestanding}% -This requirement is optional in freestanding implementations\iref{compliance}. -\end{note} \pnum The functions \tcode{atomic::is_lock_free} and diff --git a/source/utilities.tex b/source/utilities.tex index 642efdf2c9..e915e30195 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -35,6 +35,7 @@ throughout the rest of the library. \begin{codeblock} +// all freestanding #include // see \ref{compare.syn} #include // see \ref{initializer.list.syn} @@ -1350,6 +1351,7 @@ \indexheader{tuple}% \begin{codeblock} +// all freestanding #include // see \ref{compare.syn} namespace std { @@ -9396,109 +9398,115 @@ namespace std { // \ref{func.invoke}, invoke template - constexpr invoke_result_t invoke(F&& f, Args&&... args) + constexpr invoke_result_t invoke(F&& f, Args&&... args) // freestanding noexcept(is_nothrow_invocable_v); template - constexpr R invoke_r(F&& f, Args&&... args) + constexpr R invoke_r(F&& f, Args&&... args) // freestanding noexcept(is_nothrow_invocable_r_v); // \ref{refwrap}, \tcode{reference_wrapper} - template class reference_wrapper; + template class reference_wrapper; // freestanding - template constexpr reference_wrapper ref(T&) noexcept; - template constexpr reference_wrapper cref(const T&) noexcept; - template void ref(const T&&) = delete; - template void cref(const T&&) = delete; + template constexpr reference_wrapper ref(T&) noexcept; // freestanding + template constexpr reference_wrapper cref(const T&) noexcept; // freestanding + template void ref(const T&&) = delete; // freestanding + template void cref(const T&&) = delete; // freestanding - template constexpr reference_wrapper ref(reference_wrapper) noexcept; - template constexpr reference_wrapper cref(reference_wrapper) noexcept; + template + constexpr reference_wrapper ref(reference_wrapper) noexcept; // freestanding + template + constexpr reference_wrapper cref(reference_wrapper) noexcept; // freestanding // \ref{arithmetic.operations}, arithmetic operations - template struct plus; - template struct minus; - template struct multiplies; - template struct divides; - template struct modulus; - template struct negate; - template<> struct plus; - template<> struct minus; - template<> struct multiplies; - template<> struct divides; - template<> struct modulus; - template<> struct negate; + template struct plus; // freestanding + template struct minus; // freestanding + template struct multiplies; // freestanding + template struct divides; // freestanding + template struct modulus; // freestanding + template struct negate; // freestanding + template<> struct plus; // freestanding + template<> struct minus; // freestanding + template<> struct multiplies; // freestanding + template<> struct divides; // freestanding + template<> struct modulus; // freestanding + template<> struct negate; // freestanding // \ref{comparisons}, comparisons - template struct equal_to; - template struct not_equal_to; - template struct greater; - template struct less; - template struct greater_equal; - template struct less_equal; - template<> struct equal_to; - template<> struct not_equal_to; - template<> struct greater; - template<> struct less; - template<> struct greater_equal; - template<> struct less_equal; + template struct equal_to; // freestanding + template struct not_equal_to; // freestanding + template struct greater; // freestanding + template struct less; // freestanding + template struct greater_equal; // freestanding + template struct less_equal; // freestanding + template<> struct equal_to; // freestanding + template<> struct not_equal_to; // freestanding + template<> struct greater; // freestanding + template<> struct less; // freestanding + template<> struct greater_equal; // freestanding + template<> struct less_equal; // freestanding // \ref{comparisons.three.way}, class \tcode{compare_three_way} - struct compare_three_way; + struct compare_three_way; // freestanding // \ref{logical.operations}, logical operations - template struct logical_and; - template struct logical_or; - template struct logical_not; - template<> struct logical_and; - template<> struct logical_or; - template<> struct logical_not; + template struct logical_and; // freestanding + template struct logical_or; // freestanding + template struct logical_not; // freestanding + template<> struct logical_and; // freestanding + template<> struct logical_or; // freestanding + template<> struct logical_not; // freestanding // \ref{bitwise.operations}, bitwise operations - template struct bit_and; - template struct bit_or; - template struct bit_xor; - template struct bit_not; - template<> struct bit_and; - template<> struct bit_or; - template<> struct bit_xor; - template<> struct bit_not; + template struct bit_and; // freestanding + template struct bit_or; // freestanding + template struct bit_xor; // freestanding + template struct bit_not; // freestanding + template<> struct bit_and; // freestanding + template<> struct bit_or; // freestanding + template<> struct bit_xor; // freestanding + template<> struct bit_not; // freestanding // \ref{func.identity}, identity - struct identity; + struct identity; // freestanding // \ref{func.not.fn}, function template \tcode{not_fn} - template constexpr @\unspec@ not_fn(F&& f); + template constexpr @\unspec@ not_fn(F&& f); // freestanding // \ref{func.bind.partial}, function templates \tcode{bind_front} and \tcode{bind_back} - template constexpr @\unspec@ bind_front(F&&, Args&&...); - template constexpr @\unspec@ bind_back(F&&, Args&&...); + template + constexpr @\unspec@ bind_front(F&&, Args&&...); // freestanding + template + constexpr @\unspec@ bind_back(F&&, Args&&...); // freestanding // \ref{func.bind}, bind - template struct is_bind_expression; + template struct is_bind_expression; // freestanding template - inline constexpr bool @\libglobal{is_bind_expression_v}@ = is_bind_expression::value; - template struct is_placeholder; + inline constexpr bool @\libglobal{is_bind_expression_v}@ = // freestanding + is_bind_expression::value; + template struct is_placeholder; // freestanding template - inline constexpr int @\libglobal{is_placeholder_v}@ = is_placeholder::value; + inline constexpr int @\libglobal{is_placeholder_v}@ = // freestanding + is_placeholder::value; template - constexpr @\unspec@ bind(F&&, BoundArgs&&...); + constexpr @\unspec@ bind(F&&, BoundArgs&&...); // freestanding template - constexpr @\unspec@ bind(F&&, BoundArgs&&...); + constexpr @\unspec@ bind(F&&, BoundArgs&&...); // freestanding namespace placeholders { // \tcode{\placeholder{M}} is the \impldef{number of placeholders for bind expressions} number of placeholders - @\seebelownc@ _1; - @\seebelownc@ _2; + @\seebelownc@ _1; // freestanding + @\seebelownc@ _2; // freestanding . . . - @\seebelownc@ _@\placeholdernc{M}@; + @\seebelownc@ _@\placeholdernc{M}@; // freestanding } // \ref{func.memfn}, member function adaptors template - constexpr @\unspec@ mem_fn(R T::*) noexcept; + constexpr @\unspec@ mem_fn(R T::*) noexcept; // freestanding // \ref{func.wrap}, polymorphic function wrappers class bad_function_call; @@ -9521,7 +9529,7 @@ // \ref{func.search}, searchers template> - class default_searcher; + class default_searcher; // freestanding template::value_type>, @@ -9535,16 +9543,16 @@ // \ref{unord.hash}, class template hash template - struct hash; + struct hash; // freestanding namespace ranges { // \ref{range.cmp}, concept-constrained comparisons - struct equal_to; - struct not_equal_to; - struct greater; - struct less; - struct greater_equal; - struct less_equal; + struct equal_to; // freestanding + struct not_equal_to; // freestanding + struct greater; // freestanding + struct less; // freestanding + struct greater_equal; // freestanding + struct less_equal; // freestanding } } \end{codeblock} @@ -11403,6 +11411,9 @@ \end{codeblock}% \indextext{function object!binders|)} +\pnum +Placeholders are freestanding entities\iref{freestanding.entity}. + \rSec2[func.memfn]{Function template \tcode{mem_fn}}% \indextext{function object!\idxcode{mem_fn}|(} @@ -15509,6 +15520,7 @@ \rSec2[bit.syn]{Header \tcode{} synopsis} \begin{codeblock} +// all freestanding namespace std { // \ref{bit.cast}, \tcode{bit_cast} template From 5e0de8beff2c050174b09b6cdd4747ad19e147f1 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Sun, 7 Aug 2022 21:57:41 -0700 Subject: [PATCH 2/2] [ranges.syn] Colapse freestanding entities to fit on a single line --- source/ranges.tex | 90 ++++++++++++++--------------------------------- 1 file changed, 26 insertions(+), 64 deletions(-) diff --git a/source/ranges.tex b/source/ranges.tex index 40041e8568..337a85fff0 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -167,9 +167,7 @@ requires is_object_v class single_view; // freestanding - namespace views { - inline constexpr @\unspec@ single = @\unspec@; // freestanding - } + namespace views { inline constexpr @\unspecnc@ single = @\unspecnc@; } // freestanding template using @\exposidnc{maybe-const}@ = conditional_t; // \expos @@ -182,9 +180,7 @@ template inline constexpr bool enable_borrowed_range> = true; // freestanding - namespace views { - inline constexpr @\unspec@ iota = @\unspec@; // freestanding - } + namespace views { inline constexpr @\unspecnc@ iota = @\unspecnc@; } // freestanding // \ref{range.istream}, istream view template<@\libconcept{movable}@ Val, class CharT, class Traits = char_traits> @@ -195,7 +191,7 @@ template using wistream_view = basic_istream_view; - namespace views { template inline constexpr @\unspec@ istream = @\unspec@; } + namespace views { template inline constexpr @\unspecnc@ istream = @\unspecnc@; } // \ref{range.adaptor.object}, range adaptor objects template @@ -204,7 +200,7 @@ // \ref{range.all}, all view namespace views { - inline constexpr @\unspec@ all = @\unspec@; // freestanding + inline constexpr @\unspecnc@ all = @\unspecnc@; // freestanding template<@\libconcept{viewable_range}@ R> using all_t = decltype(all(declval())); // freestanding @@ -232,9 +228,7 @@ requires @\libconcept{view}@ && is_object_v class filter_view; // freestanding - namespace views { - inline constexpr @\unspec@ filter = @\unspec@; // freestanding - } + namespace views { inline constexpr @\unspecnc@ filter = @\unspecnc@; } // freestanding // \ref{range.transform}, transform view template<@\libconcept{input_range}@ V, @\libconcept{copy_constructible}@ F> @@ -243,9 +237,7 @@ @\exposconcept{can-reference}@>> class transform_view; // freestanding - namespace views { - inline constexpr @\unspec@ transform = @\unspec@; // freestanding - } + namespace views { inline constexpr @\unspecnc@ transform = @\unspecnc@; } // freestanding // \ref{range.take}, take view template<@\libconcept{view}@> class take_view; // freestanding @@ -254,9 +246,7 @@ inline constexpr bool enable_borrowed_range> = // freestanding enable_borrowed_range; - namespace views { - inline constexpr @\unspec@ take = @\unspec@; // freestanding - } + namespace views { inline constexpr @\unspecnc@ take = @\unspecnc@; } // freestanding // \ref{range.take.while}, take while view template<@\libconcept{view}@ V, class Pred> @@ -264,9 +254,7 @@ @\libconcept{indirect_unary_predicate}@> class take_while_view; // freestanding - namespace views { - inline constexpr @\unspec@ take_while = @\unspec@; // freestanding - } + namespace views { inline constexpr @\unspecnc@ take_while = @\unspecnc@; } // freestanding // \ref{range.drop}, drop view template<@\libconcept{view}@ V> @@ -276,9 +264,7 @@ inline constexpr bool enable_borrowed_range> = // freestanding enable_borrowed_range; - namespace views { - inline constexpr @\unspec@ drop = @\unspec@; // freestanding - } + namespace views { inline constexpr @\unspecnc@ drop = @\unspecnc@; } // freestanding // \ref{range.drop.while}, drop while view template<@\libconcept{view}@ V, class Pred> @@ -290,18 +276,14 @@ inline constexpr bool enable_borrowed_range> = // freestanding enable_borrowed_range; - namespace views { - inline constexpr @\unspec@ drop_while = @\unspec@; // freestanding - } + namespace views { inline constexpr @\unspecnc@ drop_while = @\unspecnc@; } // freestanding // \ref{range.join}, join view template<@\libconcept{input_range}@ V> requires @\libconcept{view}@ && @\libconcept{input_range}@> class join_view; // freestanding - namespace views { - inline constexpr @\unspec@ join = @\unspec@; // freestanding - } + namespace views { inline constexpr @\unspecnc@ join = @\unspecnc@; } // freestanding // \ref{range.join.with}, join with view template @@ -313,9 +295,7 @@ && @\exposconcept{compatible-joinable-ranges}@, Pattern> class join_with_view; // freestanding - namespace views { - inline constexpr @\unspec@ join_with = @\unspec@; // freestanding - } + namespace views { inline constexpr @\unspecnc@ join_with = @\unspecnc@; } // freestanding // \ref{range.lazy.split}, lazy split view template @@ -334,14 +314,12 @@ class split_view; // freestanding namespace views { - inline constexpr @\unspec@ lazy_split = @\unspec@; // freestanding - inline constexpr @\unspec@ split = @\unspec@; // freestanding + inline constexpr @\unspecnc@ lazy_split = @\unspecnc@; // freestanding + inline constexpr @\unspecnc@ split = @\unspecnc@; // freestanding } // \ref{range.counted}, counted view - namespace views { - inline constexpr @\unspec@ counted = @\unspec@; // freestanding - } + namespace views { inline constexpr @\unspecnc@ counted = @\unspecnc@; } // freestanding // \ref{range.common}, common view template<@\libconcept{view}@ V> @@ -352,9 +330,7 @@ inline constexpr bool enable_borrowed_range> = // freestanding enable_borrowed_range; - namespace views { - inline constexpr @\unspec@ common = @\unspec@; // freestanding - } + namespace views { inline constexpr @\unspecnc@ common = @\unspecnc@; } // freestanding // \ref{range.reverse}, reverse view template<@\libconcept{view}@ V> @@ -365,9 +341,7 @@ inline constexpr bool enable_borrowed_range> = // freestanding enable_borrowed_range; - namespace views { - inline constexpr @\unspec@ reverse = @\unspec@; // freestanding - } + namespace views { inline constexpr @\unspecnc@ reverse = @\unspecnc@; } // freestanding // \ref{range.elements}, elements view template<@\libconcept{input_range}@ V, size_t N> @@ -385,7 +359,7 @@ namespace views { template - inline constexpr @\unspec@ elements = @\unspec@; // freestanding + inline constexpr @\unspecnc@ elements = @\unspecnc@; // freestanding inline constexpr auto @\libmember{keys}{views}@ = elements<0>; // freestanding inline constexpr auto @\libmember{values}{views}@ = elements<1>; // freestanding } @@ -399,9 +373,7 @@ inline constexpr bool enable_borrowed_range> = // freestanding (enable_borrowed_range && ...); - namespace views { - inline constexpr @\unspec@ zip = @\unspec@; // freestanding - } + namespace views { inline constexpr @\unspecnc@ zip = @\unspecnc@; } // freestanding // \ref{range.zip.transform}, zip transform view template<@\libconcept{copy_constructible}@ F, @\libconcept{input_range}@... Views> @@ -410,9 +382,7 @@ @\exposconcept{can-reference}@...>> class zip_transform_view; // freestanding - namespace views { - inline constexpr @\unspec@ zip_transform = @\unspec@; // freestanding - } + namespace views { inline constexpr @\unspecnc@ zip_transform = @\unspecnc@; } // freestanding // \ref{range.adjacent}, adjacent view template<@\libconcept{forward_range}@ V, size_t N> @@ -425,7 +395,7 @@ namespace views { template - inline constexpr @\unspec@ adjacent = @\unspec@ ; // freestanding + inline constexpr @\unspecnc@ adjacent = @\unspecnc@; // freestanding inline constexpr auto @\libmember{pairwise}{views}@ = adjacent<2>; // freestanding } @@ -436,7 +406,7 @@ namespace views { template - inline constexpr @\unspec@ adjacent_transform = @\unspec@; // freestanding + inline constexpr @\unspecnc@ adjacent_transform = @\unspecnc@; // freestanding inline constexpr auto @\libmember{pairwise_transform}{views}@ = adjacent_transform<2>; // freestanding } @@ -453,9 +423,7 @@ inline constexpr bool enable_borrowed_range> = // freestanding @\libconcept{forward_range}@ && enable_borrowed_range; - namespace views { - inline constexpr @\unspec@ chunk = @\unspec@; // freestanding - } + namespace views { inline constexpr @\unspecnc@ chunk = @\unspecnc@; } // freestanding // \ref{range.slide}, slide view template<@\libconcept{forward_range}@ V> @@ -466,18 +434,14 @@ inline constexpr bool enable_borrowed_range> = enable_borrowed_range; // freestanding - namespace views { - inline constexpr @\unspec@ slide = @\unspec@; // freestanding - } + namespace views { inline constexpr @\unspecnc@ slide = @\unspecnc@; } // freestanding // \ref{range.chunk.by}, chunk by view template<@\libconcept{forward_range}@ V, @\libconcept{indirect_binary_predicate}@, iterator_t> Pred> requires @\libconcept{view}@ && is_object_v class chunk_by_view; // freestanding - namespace views { // freestanding - inline constexpr @\unspec@ chunk_by = @\unspec@; // freestanding - } + namespace views { inline constexpr @\unspecnc@ chunk_by = @\unspecnc@; } // freestanding } namespace std { @@ -506,9 +470,7 @@ using type = S; // freestanding }; - struct from_range_t { // freestanding - explicit from_range_t() = default; // freestanding - }; + struct from_range_t { explicit from_range_t() = default; }; // freestanding inline constexpr from_range_t from_range{}; // freestanding } \end{codeblock}