Skip to content

Commit 7805874

Browse files
authored
Merge 2023-11 LWG Motion 1
P3040R0 C++ Standard Library Issues to be moved in Kona, Nov. 2023
2 parents db09152 + a3fdcf1 commit 7805874

File tree

11 files changed

+129
-80
lines changed

11 files changed

+129
-80
lines changed

source/containers.tex

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@
887887

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

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

18360+
\pnum
18361+
For a \tcode{span} \tcode{s},
18362+
any operation that invalidates a pointer in
18363+
the range \range{s.data()}{s.data() + s.size()}
18364+
invalidates pointers, iterators, and references to elements of \tcode{s}.
18365+
1835818366
\rSec4[span.cons]{Constructors, copy, and assignment}
1835918367

1836018368
\indexlibraryctor{span}%
@@ -19018,6 +19026,9 @@
1901819026
template<class LayoutMapping>
1901919027
struct submdspan_mapping_result;
1902019028

19029+
struct full_extent_t { explicit full_extent_t() = default; };
19030+
inline constexpr full_extent_t full_extent{};
19031+
1902119032
template<class IndexType, class... Extents, class... SliceSpecifiers>
1902219033
constexpr auto submdspan_extents(const extents<IndexType, Extents...>&, SliceSpecifiers...);
1902319034

@@ -21462,7 +21473,7 @@
2146221473
is \tcode{true}.
2146321474
Equivalent to:
2146421475
\begin{codeblock}
21465-
return operator[](as_const(indices[P])...);
21476+
return operator[](extents_type::@\exposid{index-cast}@(as_const(indices[P]))...);
2146621477
\end{codeblock}
2146721478
\end{itemdescr}
2146821479

source/future.tex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,10 +2124,12 @@
21242124
\tcode{codecvt_utf16}, and \tcode{codecvt_utf8_utf16}:
21252125
\begin{itemize}
21262126
\item
2127-
\tcode{Elem} is the wide-character type, such as
2127+
\tcode{Elem} is one of
21282128
\keyword{wchar_t}, \keyword{char16_t}, or \keyword{char32_t}.
21292129
\item
2130-
\tcode{Maxcode} is the largest wide-character code that the facet
2130+
\tcode{Maxcode} is the largest value of \tcode{Elem}
2131+
converted to \tcode{\keyword{unsigned} \keyword{long}}
2132+
that the facet
21312133
will read or write without reporting a conversion error.
21322134
\item
21332135
If \tcode{(Mode \& consume_header)}, the facet shall consume an

source/iostreams.tex

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@
128128
\pnum
129129
In the classes of \ref{input.output}, a template parameter with name
130130
\tcode{charT} represents a member of the set of types containing \tcode{char}, \keyword{wchar_t},
131-
and any other \impldef{set of character types that iostreams templates can be instantiated for}
132-
character types that meet the requirements for a character on which any of
131+
and any other \impldef{set of character container types that iostreams templates can be instantiated for}
132+
character container types\iref{defns.character.container}
133+
that meet the requirements for a character on which any of
133134
the iostream components can be instantiated.
134135

135136
\rSec2[iostreams.threadsafety]{Thread safety}
@@ -6361,7 +6362,7 @@
63616362
If a formatted output function of a stream \tcode{os} determines
63626363
padding, it does so as
63636364
follows. Given a \tcode{charT} character sequence \tcode{seq} where
6364-
\tcode{charT} is the character type of the stream, if
6365+
\tcode{charT} is the character container type of the stream, if
63656366
the length of \tcode{seq} is less than \tcode{os.width()}, then enough copies of
63666367
\tcode{os.fill()} are added to this sequence as necessary to pad to a
63676368
width of \tcode{os.width()} characters. If
@@ -6705,7 +6706,7 @@
67056706
of \tcode{out}. Constructs a character sequence \tcode{seq}.
67066707
If \tcode{c} has type
67076708
\tcode{char}
6708-
and the character type of the stream is not
6709+
and the character container type of the stream is not
67096710
\tcode{char},
67106711
then \tcode{seq} consists of
67116712
\tcode{out.widen(c)};

source/iterators.tex

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5458,7 +5458,7 @@
54585458
friend constexpr iter_difference_t<I2> operator-(
54595459
const common_iterator& x, const common_iterator<I2, S2>& y);
54605460

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

54915491
\pnum
5492-
The nested \grammarterm{typedef-name}s of the specialization of
5493-
\tcode{iterator_traits} for \tcode{common_iterator<I, S>} are defined as follows.
5492+
The nested \grammarterm{typedef-name} \tcode{iterator_category} of
5493+
the specialization of \tcode{iterator_traits} for \tcode{common_iterator<I, S>}
5494+
is defined if and only if \tcode{iter_difference_t<I>} is an integral type.
5495+
In that case,
5496+
\tcode{iterator_category} denotes \tcode{forward_iterator_tag} if
5497+
the \grammarterm{qualified-id} \tcode{iterator_traits<I>::iterator_category}
5498+
is valid and denotes a type that
5499+
models \tcode{\libconcept{derived_from}<forward_iterator_tag>};
5500+
otherwise it denotes \tcode{input_iterator_tag}.
5501+
5502+
\pnum
5503+
The remaining nested \grammarterm{typedef-name}s of the specialization of
5504+
\tcode{iterator_traits} for \tcode{common_iterator<I, S>} are defined as follows:
54945505
\begin{itemize}
54955506
\item
54965507
\tcode{iterator_concept} denotes \tcode{forward_iterator_tag}
54975508
if \tcode{I} models \libconcept{forward_iterator};
54985509
otherwise it denotes \tcode{input_iterator_tag}.
54995510

5500-
\item
5501-
\tcode{iterator_category} denotes
5502-
\tcode{forward_iterator_tag}
5503-
if the \grammarterm{qualified-id} \tcode{iterator_traits<I>::iter\-ator_category}
5504-
is valid and denotes a type that
5505-
models \tcode{\libconcept{derived_from}<forward_iterator_tag>};
5506-
otherwise it denotes \tcode{input_iterator_tag}.
5507-
55085511
\item
55095512
Let \tcode{a} denote an lvalue of type \tcode{const common_iterator<I, S>}.
55105513
If the expression \tcode{a.operator->()} is well-formed,
@@ -5797,7 +5800,7 @@
57975800

57985801
\indexlibrarymember{iter_move}{common_iterator}%
57995802
\begin{itemdecl}
5800-
friend constexpr iter_rvalue_reference_t<I> iter_move(const common_iterator& i)
5803+
friend constexpr decltype(auto) iter_move(const common_iterator& i)
58015804
noexcept(noexcept(ranges::iter_move(declval<const I&>())))
58025805
requires @\libconcept{input_iterator}@<I>;
58035806
\end{itemdecl}
@@ -5956,7 +5959,7 @@
59565959
friend constexpr strong_ordering operator<=>(
59575960
const counted_iterator& x, const counted_iterator<I2>& y);
59585961

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

63856388
\indexlibrarymember{iter_move}{counted_iterator}%
63866389
\begin{itemdecl}
6387-
friend constexpr iter_rvalue_reference_t<I>
6390+
friend constexpr decltype(auto)
63886391
iter_move(const counted_iterator& i)
63896392
noexcept(noexcept(ranges::iter_move(i.current)))
63906393
requires @\libconcept{input_iterator}@<I>;
@@ -7212,6 +7215,8 @@
72127215
headers are included:
72137216
\libheaderref{array},
72147217
\libheaderref{deque},
7218+
\libheaderrefx{flat_map}{flat.map.syn},
7219+
\libheaderrefx{flat_set}{flat.set.syn},
72157220
\libheaderrefx{forward_list}{forward.list.syn},
72167221
\libheaderref{list},
72177222
\libheaderrefx{map}{associative.map.syn},

source/locales.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,9 @@
394394
respectively\iref{iterator.requirements}.
395395
A template parameter with name \tcode{C} represents
396396
the set of types containing \keyword{char}, \keyword{wchar_t}, and any other
397-
\impldef{set of character types
397+
\impldef{set of character container types
398398
that iostreams templates can be instantiated for}
399-
character types
399+
character container types\iref{defns.character.container}
400400
that meet the requirements for a character
401401
on which any of the iostream components can be instantiated.
402402
A template parameter with name \tcode{International}

source/memory.tex

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5451,10 +5451,8 @@
54515451
% pretend to \item that there is real text here, but undo the vertical spacing
54525452
\mbox{}\vspace{-\baselineskip}\vspace{-\parskip}
54535453
\begin{codeblock}
5454-
if (p) {
5455-
apply([&](auto&&... args) {
5456-
s = Smart( static_cast<SP>(p), std::forward<Args>(args)...); }, std::move(a));
5457-
}
5454+
apply([&](auto&&... args) {
5455+
s = Smart(static_cast<SP>(p), std::forward<Args>(args)...); }, std::move(a));
54585456
\end{codeblock}
54595457
if \tcode{is_pointer_v<Smart>} is \tcode{true};
54605458
\item

source/numerics.tex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2885,13 +2885,13 @@
28852885
static constexpr size_t long_lag = r;
28862886
static constexpr result_type min() { return 0; }
28872887
static constexpr result_type max() { return @$m - 1$@; }
2888-
static constexpr result_type default_seed = 19780503u;
2888+
static constexpr uint_least32_t default_seed = 19780503u;
28892889

28902890
// constructors and seeding functions
2891-
subtract_with_carry_engine() : subtract_with_carry_engine(default_seed) {}
2891+
subtract_with_carry_engine() : subtract_with_carry_engine(0u) {}
28922892
explicit subtract_with_carry_engine(result_type value);
28932893
template<class Sseq> explicit subtract_with_carry_engine(Sseq& q);
2894-
void seed(result_type value = default_seed);
2894+
void seed(result_type value = 0u);
28952895
template<class Sseq> void seed(Sseq& q);
28962896

28972897
// equality operators
@@ -2946,7 +2946,7 @@
29462946
first construct \tcode{e}, a \tcode{linear_congruential_engine} object,
29472947
as if by the following definition:
29482948
\begin{codeblock}
2949-
linear_congruential_engine<result_type,
2949+
linear_congruential_engine<uint_least32_t,
29502950
40014u,0u,2147483563u> e(value == 0u ? default_seed : value);
29512951
\end{codeblock}
29522952
Then, to set each $X_k$,

source/ranges.tex

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@
6565
template<@\libconcept{range}@ R>
6666
using sentinel_t = decltype(ranges::end(declval<R&>())); // freestanding
6767
template<@\libconcept{range}@ R>
68-
using const_iterator_t = const_iterator<iterator_t<R>>; // freestanding
68+
using const_iterator_t = decltype(ranges::cbegin(declval<R&>())); // freestanding
6969
template<@\libconcept{range}@ R>
70-
using const_sentinel_t = const_sentinel<sentinel_t<R>>; // freestanding
70+
using const_sentinel_t = decltype(ranges::cend(declval<R&>())); // freestanding
7171
template<@\libconcept{range}@ R>
7272
using range_difference_t = iter_difference_t<iterator_t<R>>; // freestanding
7373
template<@\libconcept{sized_range}@ R>
@@ -393,7 +393,7 @@
393393

394394
// \ref{range.as.const}, as const view
395395
template<@\libconcept{input_range}@ R>
396-
constexpr auto& @\exposid{possibly-const-range}@(R& r) { // \expos
396+
constexpr auto& @\exposid{possibly-const-range}@(R& r) noexcept { // \expos
397397
if constexpr (@\libconcept{constant_range}@<const R> && !@\libconcept{constant_range}@<R>) {
398398
return const_cast<const R&>(r);
399399
} else {
@@ -1184,7 +1184,7 @@
11841184

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

11901190
\pnum
@@ -2685,6 +2685,7 @@
26852685
constexpr auto end() const;
26862686
constexpr @\exposid{iterator}@ end() const requires @\libconcept{same_as}@<W, Bound>;
26872687

2688+
constexpr bool empty() const;
26882689
constexpr auto size() const requires @\seebelow@;
26892690
};
26902691

@@ -2902,6 +2903,17 @@
29022903
Equivalent to: \tcode{return \exposid{iterator}\{\exposid{bound_}\};}
29032904
\end{itemdescr}
29042905

2906+
\indexlibrarymember{empty}{iota_view}%
2907+
\begin{itemdecl}
2908+
constexpr bool empty() const;
2909+
\end{itemdecl}
2910+
2911+
\begin{itemdescr}
2912+
\pnum
2913+
\effects
2914+
Equivalent to: \tcode{return \exposid{value_} == \exposid{bound_};}
2915+
\end{itemdescr}
2916+
29052917
\indexlibrarymember{size}{iota_view}%
29062918
\begin{itemdecl}
29072919
constexpr auto size() const requires @\seebelow@;
@@ -11884,7 +11896,7 @@
1188411896
adjacent_transform_view() = default;
1188511897
constexpr explicit adjacent_transform_view(V base, F fun);
1188611898

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

1189011902
constexpr auto begin() {

source/strings.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,10 +751,10 @@
751751
any operation that invalidates a pointer
752752
in the range
753753
\begin{codeblock}
754-
@\range{str.data()}{\brk{}str.data() + str.size()}@
754+
@\range{str.data()}{str.data() + str.size()}@
755755
\end{codeblock}
756756
invalidates pointers, iterators, and references
757-
returned from \tcode{str}'s member functions.
757+
to elements of \tcode{str}.
758758

759759
\pnum
760760
The complexity of \tcode{basic_string_view} member functions is \bigoh{1}

source/threads.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3712,6 +3712,7 @@
37123712

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

37163717
\pnum
37173718
\begin{note}

0 commit comments

Comments
 (0)