Skip to content

Commit

Permalink
Merge 2023-11 LWG Motion 1
Browse files Browse the repository at this point in the history
P3040R0 C++ Standard Library Issues to be moved in Kona, Nov. 2023
  • Loading branch information
tkoeppe authored Dec 17, 2023
2 parents db09152 + a3fdcf1 commit 7805874
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 80 deletions.
17 changes: 14 additions & 3 deletions source/containers.tex
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@

\pnum
\expects
Either \tcode{<=>} is defined for values of type (possibly const) \tcode{T},
Either \tcode{T} models \libconcept{three_way_comparable},
or \tcode{<} is defined for values of type (possibly const) \tcode{T} and
\tcode{<} is a total ordering relationship.

Expand Down Expand Up @@ -919,7 +919,9 @@
and an \tcode{allocator_type} identical to \tcode{allocator_traits<A>::rebind_alloc<T>}
and given an lvalue \tcode{m} of type \tcode{A},
a pointer \tcode{p} of type \tcode{T*},
an expression \tcode{v} of type \tcode{T} or \tcode{const T},
an expression \tcode{v} that denotes
an lvalue of type \tcode{T} or \tcode{const T} or
an rvalue of type \tcode{const T},
and an rvalue \tcode{rv} of type \tcode{T},
the following terms are defined. If \tcode{X}
is not allocator-aware or is a specialization of \tcode{basic_string},
Expand Down Expand Up @@ -18355,6 +18357,12 @@
\tcode{ElementType} is required to be
a complete object type that is not an abstract class type.

\pnum
For a \tcode{span} \tcode{s},
any operation that invalidates a pointer in
the range \range{s.data()}{s.data() + s.size()}
invalidates pointers, iterators, and references to elements of \tcode{s}.

\rSec4[span.cons]{Constructors, copy, and assignment}

\indexlibraryctor{span}%
Expand Down Expand Up @@ -19018,6 +19026,9 @@
template<class LayoutMapping>
struct submdspan_mapping_result;

struct full_extent_t { explicit full_extent_t() = default; };
inline constexpr full_extent_t full_extent{};

template<class IndexType, class... Extents, class... SliceSpecifiers>
constexpr auto submdspan_extents(const extents<IndexType, Extents...>&, SliceSpecifiers...);

Expand Down Expand Up @@ -21462,7 +21473,7 @@
is \tcode{true}.
Equivalent to:
\begin{codeblock}
return operator[](as_const(indices[P])...);
return operator[](extents_type::@\exposid{index-cast}@(as_const(indices[P]))...);
\end{codeblock}
\end{itemdescr}

Expand Down
6 changes: 4 additions & 2 deletions source/future.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2124,10 +2124,12 @@
\tcode{codecvt_utf16}, and \tcode{codecvt_utf8_utf16}:
\begin{itemize}
\item
\tcode{Elem} is the wide-character type, such as
\tcode{Elem} is one of
\keyword{wchar_t}, \keyword{char16_t}, or \keyword{char32_t}.
\item
\tcode{Maxcode} is the largest wide-character code that the facet
\tcode{Maxcode} is the largest value of \tcode{Elem}
converted to \tcode{\keyword{unsigned} \keyword{long}}
that the facet
will read or write without reporting a conversion error.
\item
If \tcode{(Mode \& consume_header)}, the facet shall consume an
Expand Down
9 changes: 5 additions & 4 deletions source/iostreams.tex
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@
\pnum
In the classes of \ref{input.output}, a template parameter with name
\tcode{charT} represents a member of the set of types containing \tcode{char}, \keyword{wchar_t},
and any other \impldef{set of character types that iostreams templates can be instantiated for}
character types that meet the requirements for a character on which any of
and any other \impldef{set of character container types that iostreams templates can be instantiated for}
character container types\iref{defns.character.container}
that meet the requirements for a character on which any of
the iostream components can be instantiated.

\rSec2[iostreams.threadsafety]{Thread safety}
Expand Down Expand Up @@ -6361,7 +6362,7 @@
If a formatted output function of a stream \tcode{os} determines
padding, it does so as
follows. Given a \tcode{charT} character sequence \tcode{seq} where
\tcode{charT} is the character type of the stream, if
\tcode{charT} is the character container type of the stream, if
the length of \tcode{seq} is less than \tcode{os.width()}, then enough copies of
\tcode{os.fill()} are added to this sequence as necessary to pad to a
width of \tcode{os.width()} characters. If
Expand Down Expand Up @@ -6705,7 +6706,7 @@
of \tcode{out}. Constructs a character sequence \tcode{seq}.
If \tcode{c} has type
\tcode{char}
and the character type of the stream is not
and the character container type of the stream is not
\tcode{char},
then \tcode{seq} consists of
\tcode{out.widen(c)};
Expand Down
35 changes: 20 additions & 15 deletions source/iterators.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5458,7 +5458,7 @@
friend constexpr iter_difference_t<I2> operator-(
const common_iterator& x, const common_iterator<I2, S2>& y);

friend constexpr iter_rvalue_reference_t<I> iter_move(const common_iterator& i)
friend constexpr decltype(auto) iter_move(const common_iterator& i)
noexcept(noexcept(ranges::iter_move(declval<const I&>())))
requires @\libconcept{input_iterator}@<I>;
template<@\libconcept{indirectly_swappable}@<I> I2, class S2>
Expand All @@ -5477,7 +5477,7 @@
template<@\libconcept{input_iterator}@ I, class S>
struct iterator_traits<common_iterator<I, S>> {
using iterator_concept = @\seebelow@;
using iterator_category = @\seebelow@;
using iterator_category = @\seebelow@; // not always present
using value_type = iter_value_t<I>;
using difference_type = iter_difference_t<I>;
using pointer = @\seebelow@;
Expand All @@ -5489,22 +5489,25 @@
\rSec3[common.iter.types]{Associated types}

\pnum
The nested \grammarterm{typedef-name}s of the specialization of
\tcode{iterator_traits} for \tcode{common_iterator<I, S>} are defined as follows.
The nested \grammarterm{typedef-name} \tcode{iterator_category} of
the specialization of \tcode{iterator_traits} for \tcode{common_iterator<I, S>}
is defined if and only if \tcode{iter_difference_t<I>} is an integral type.
In that case,
\tcode{iterator_category} denotes \tcode{forward_iterator_tag} if
the \grammarterm{qualified-id} \tcode{iterator_traits<I>::iterator_category}
is valid and denotes a type that
models \tcode{\libconcept{derived_from}<forward_iterator_tag>};
otherwise it denotes \tcode{input_iterator_tag}.

\pnum
The remaining nested \grammarterm{typedef-name}s of the specialization of
\tcode{iterator_traits} for \tcode{common_iterator<I, S>} are defined as follows:
\begin{itemize}
\item
\tcode{iterator_concept} denotes \tcode{forward_iterator_tag}
if \tcode{I} models \libconcept{forward_iterator};
otherwise it denotes \tcode{input_iterator_tag}.

\item
\tcode{iterator_category} denotes
\tcode{forward_iterator_tag}
if the \grammarterm{qualified-id} \tcode{iterator_traits<I>::iter\-ator_category}
is valid and denotes a type that
models \tcode{\libconcept{derived_from}<forward_iterator_tag>};
otherwise it denotes \tcode{input_iterator_tag}.

\item
Let \tcode{a} denote an lvalue of type \tcode{const common_iterator<I, S>}.
If the expression \tcode{a.operator->()} is well-formed,
Expand Down Expand Up @@ -5797,7 +5800,7 @@

\indexlibrarymember{iter_move}{common_iterator}%
\begin{itemdecl}
friend constexpr iter_rvalue_reference_t<I> iter_move(const common_iterator& i)
friend constexpr decltype(auto) iter_move(const common_iterator& i)
noexcept(noexcept(ranges::iter_move(declval<const I&>())))
requires @\libconcept{input_iterator}@<I>;
\end{itemdecl}
Expand Down Expand Up @@ -5956,7 +5959,7 @@
friend constexpr strong_ordering operator<=>(
const counted_iterator& x, const counted_iterator<I2>& y);

friend constexpr iter_rvalue_reference_t<I> iter_move(const counted_iterator& i)
friend constexpr decltype(auto) iter_move(const counted_iterator& i)
noexcept(noexcept(ranges::iter_move(i.current)))
requires @\libconcept{input_iterator}@<I>;
template<@\libconcept{indirectly_swappable}@<I> I2>
Expand Down Expand Up @@ -6384,7 +6387,7 @@

\indexlibrarymember{iter_move}{counted_iterator}%
\begin{itemdecl}
friend constexpr iter_rvalue_reference_t<I>
friend constexpr decltype(auto)
iter_move(const counted_iterator& i)
noexcept(noexcept(ranges::iter_move(i.current)))
requires @\libconcept{input_iterator}@<I>;
Expand Down Expand Up @@ -7212,6 +7215,8 @@
headers are included:
\libheaderref{array},
\libheaderref{deque},
\libheaderrefx{flat_map}{flat.map.syn},
\libheaderrefx{flat_set}{flat.set.syn},
\libheaderrefx{forward_list}{forward.list.syn},
\libheaderref{list},
\libheaderrefx{map}{associative.map.syn},
Expand Down
4 changes: 2 additions & 2 deletions source/locales.tex
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,9 @@
respectively\iref{iterator.requirements}.
A template parameter with name \tcode{C} represents
the set of types containing \keyword{char}, \keyword{wchar_t}, and any other
\impldef{set of character types
\impldef{set of character container types
that iostreams templates can be instantiated for}
character types
character container types\iref{defns.character.container}
that meet the requirements for a character
on which any of the iostream components can be instantiated.
A template parameter with name \tcode{International}
Expand Down
6 changes: 2 additions & 4 deletions source/memory.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5451,10 +5451,8 @@
% pretend to \item that there is real text here, but undo the vertical spacing
\mbox{}\vspace{-\baselineskip}\vspace{-\parskip}
\begin{codeblock}
if (p) {
apply([&](auto&&... args) {
s = Smart( static_cast<SP>(p), std::forward<Args>(args)...); }, std::move(a));
}
apply([&](auto&&... args) {
s = Smart(static_cast<SP>(p), std::forward<Args>(args)...); }, std::move(a));
\end{codeblock}
if \tcode{is_pointer_v<Smart>} is \tcode{true};
\item
Expand Down
8 changes: 4 additions & 4 deletions source/numerics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2885,13 +2885,13 @@
static constexpr size_t long_lag = r;
static constexpr result_type min() { return 0; }
static constexpr result_type max() { return @$m - 1$@; }
static constexpr result_type default_seed = 19780503u;
static constexpr uint_least32_t default_seed = 19780503u;

// constructors and seeding functions
subtract_with_carry_engine() : subtract_with_carry_engine(default_seed) {}
subtract_with_carry_engine() : subtract_with_carry_engine(0u) {}
explicit subtract_with_carry_engine(result_type value);
template<class Sseq> explicit subtract_with_carry_engine(Sseq& q);
void seed(result_type value = default_seed);
void seed(result_type value = 0u);
template<class Sseq> void seed(Sseq& q);

// equality operators
Expand Down Expand Up @@ -2946,7 +2946,7 @@
first construct \tcode{e}, a \tcode{linear_congruential_engine} object,
as if by the following definition:
\begin{codeblock}
linear_congruential_engine<result_type,
linear_congruential_engine<uint_least32_t,
40014u,0u,2147483563u> e(value == 0u ? default_seed : value);
\end{codeblock}
Then, to set each $X_k$,
Expand Down
22 changes: 17 additions & 5 deletions source/ranges.tex
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
template<@\libconcept{range}@ R>
using sentinel_t = decltype(ranges::end(declval<R&>())); // freestanding
template<@\libconcept{range}@ R>
using const_iterator_t = const_iterator<iterator_t<R>>; // freestanding
using const_iterator_t = decltype(ranges::cbegin(declval<R&>())); // freestanding
template<@\libconcept{range}@ R>
using const_sentinel_t = const_sentinel<sentinel_t<R>>; // freestanding
using const_sentinel_t = decltype(ranges::cend(declval<R&>())); // freestanding
template<@\libconcept{range}@ R>
using range_difference_t = iter_difference_t<iterator_t<R>>; // freestanding
template<@\libconcept{sized_range}@ R>
Expand Down Expand Up @@ -393,7 +393,7 @@

// \ref{range.as.const}, as const view
template<@\libconcept{input_range}@ R>
constexpr auto& @\exposid{possibly-const-range}@(R& r) { // \expos
constexpr auto& @\exposid{possibly-const-range}@(R& r) noexcept { // \expos
if constexpr (@\libconcept{constant_range}@<const R> && !@\libconcept{constant_range}@<R>) {
return const_cast<const R&>(r);
} else {
Expand Down Expand Up @@ -1184,7 +1184,7 @@

\begin{codeblock}
template<class T>
constexpr auto @\exposid{as-const-pointer}@(const T* p) { return p; } // \expos
constexpr auto @\exposid{as-const-pointer}@(const T* p) noexcept { return p; } // \expos
\end{codeblock}

\pnum
Expand Down Expand Up @@ -2685,6 +2685,7 @@
constexpr auto end() const;
constexpr @\exposid{iterator}@ end() const requires @\libconcept{same_as}@<W, Bound>;

constexpr bool empty() const;
constexpr auto size() const requires @\seebelow@;
};

Expand Down Expand Up @@ -2902,6 +2903,17 @@
Equivalent to: \tcode{return \exposid{iterator}\{\exposid{bound_}\};}
\end{itemdescr}

\indexlibrarymember{empty}{iota_view}%
\begin{itemdecl}
constexpr bool empty() const;
\end{itemdecl}

\begin{itemdescr}
\pnum
\effects
Equivalent to: \tcode{return \exposid{value_} == \exposid{bound_};}
\end{itemdescr}

\indexlibrarymember{size}{iota_view}%
\begin{itemdecl}
constexpr auto size() const requires @\seebelow@;
Expand Down Expand Up @@ -11884,7 +11896,7 @@
adjacent_transform_view() = default;
constexpr explicit adjacent_transform_view(V base, F fun);

constexpr V base() const & requires @\libconcept{copy_constructible}@<@\exposid{InnerView}@> { return @\exposid{inner_}@.base(); }
constexpr V base() const & requires @\libconcept{copy_constructible}@<V> { return @\exposid{inner_}@.base(); }
constexpr V base() && { return std::move(@\exposid{inner_}@).base(); }

constexpr auto begin() {
Expand Down
4 changes: 2 additions & 2 deletions source/strings.tex
Original file line number Diff line number Diff line change
Expand Up @@ -751,10 +751,10 @@
any operation that invalidates a pointer
in the range
\begin{codeblock}
@\range{str.data()}{\brk{}str.data() + str.size()}@
@\range{str.data()}{str.data() + str.size()}@
\end{codeblock}
invalidates pointers, iterators, and references
returned from \tcode{str}'s member functions.
to elements of \tcode{str}.

\pnum
The complexity of \tcode{basic_string_view} member functions is \bigoh{1}
Expand Down
1 change: 1 addition & 0 deletions source/threads.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3712,6 +3712,7 @@

\pnum
The specialization \tcode{atomic<bool>} is a standard-layout struct.
It has a trivial destructor.

\pnum
\begin{note}
Expand Down
Loading

0 comments on commit 7805874

Please sign in to comment.