Skip to content

Commit 17836b7

Browse files
authored
Merge 2024-03 LWG Motion 1
P3180R0 C++ Standard Library Issues to be moved in Tokyo, Mar. 2024
2 parents 33c86c1 + d72daf7 commit 17836b7

File tree

8 files changed

+138
-110
lines changed

8 files changed

+138
-110
lines changed

source/algorithms.tex

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10773,11 +10773,9 @@
1077310773
\rSec3[numeric.sat.func]{Arithmetic functions}
1077410774

1077510775
\pnum
10776-
\begin{note}
1077710776
In the following descriptions, an arithmetic operation
1077810777
is performed as a mathematical operation with infinite range and then
1077910778
it is determined whether the mathematical result fits into the result type.
10780-
\end{note}
1078110779

1078210780
\indexlibraryglobal{add_sat}%
1078310781
\begin{itemdecl}

source/containers.tex

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18837,8 +18837,12 @@
1883718837
\tcode{idx < size()} is \tcode{true}.
1883818838

1883918839
\pnum
18840-
\effects
18841-
Equivalent to: \tcode{return *(data() + idx);}
18840+
\returns
18841+
\tcode{*(data() + idx)}.
18842+
18843+
\pnum
18844+
\throws
18845+
Nothing.
1884218846
\end{itemdescr}
1884318847

1884418848
\indexlibrarymember{span}{at}%
@@ -18867,8 +18871,12 @@
1886718871
\tcode{empty()} is \tcode{false}.
1886818872

1886918873
\pnum
18870-
\effects
18871-
Equivalent to: \tcode{return *data();}
18874+
\returns
18875+
\tcode{*data()}.
18876+
18877+
\pnum
18878+
\throws
18879+
Nothing.
1887218880
\end{itemdescr}
1887318881

1887418882
\indexlibrarymember{span}{back}%
@@ -18882,8 +18890,12 @@
1888218890
\tcode{empty()} is \tcode{false}.
1888318891

1888418892
\pnum
18885-
\effects
18886-
Equivalent to: \tcode{return *(data() + (size() - 1));}
18893+
\returns
18894+
\tcode{*(data() + (size() - 1))}.
18895+
18896+
\pnum
18897+
\throws
18898+
Nothing.
1888718899
\end{itemdescr}
1888818900

1888918901
\indexlibrarymember{span}{data}%
@@ -18893,8 +18905,8 @@
1889318905

1889418906
\begin{itemdescr}
1889518907
\pnum
18896-
\effects
18897-
Equivalent to: \tcode{return \exposid{data_};}
18908+
\returns
18909+
\exposid{data_}.
1889818910
\end{itemdescr}
1889918911

1890018912
\rSec4[span.iterators]{Iterator support}

source/future.tex

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@
232232
\indexlibraryglobal{__alignas_is_defined}%
233233
\begin{codeblock}
234234
#define @\xname{alignas_is_defined}@ 1
235+
#define @\xname{alignof_is_defined}@ 1
235236
\end{codeblock}
236237

237238
\pnum
@@ -2410,6 +2411,8 @@
24102411
\begin{codeblock}
24112412
codecvt<char16_t, char, mbstate_t>
24122413
codecvt<char32_t, char, mbstate_t>
2414+
codecvt<char16_t, char8_t, mbstate_t>
2415+
codecvt<char32_t, char8_t, mbstate_t>
24132416
\end{codeblock}
24142417

24152418
\pnum
@@ -2420,18 +2423,22 @@
24202423
\begin{codeblock}
24212424
codecvt_byname<char16_t, char, mbstate_t>
24222425
codecvt_byname<char32_t, char, mbstate_t>
2426+
codecvt_byname<char16_t, char8_t, mbstate_t>
2427+
codecvt_byname<char32_t, char8_t, mbstate_t>
24232428
\end{codeblock}
24242429

24252430
\pnum
24262431
The following class template specializations are required
24272432
in addition to those specified in~\ref{locale.codecvt}.
24282433
\indextext{UTF-8}%
24292434
\indextext{UTF-16}%
2430-
The specialization \tcode{codecvt<char16_t, char, mbstate_t>}
2431-
converts between the UTF-16 and UTF-8 encoding forms, and
2435+
The specializations \tcode{codecvt<char16_t, char, mbstate_t>} and
2436+
\tcode{codecvt<char16_t, char8_t, mbstate_t>}
2437+
convert between the UTF-16 and UTF-8 encoding forms, and
24322438
\indextext{UTF-32}%
2433-
the specialization \tcode{codecvt<char32_t, char, mbstate_t>}
2434-
converts between the UTF-32 and UTF-8 encoding forms.
2439+
the specializations \tcode{codecvt<char32_t, char, mbstate_t>} and
2440+
\tcode{codecvt<char32_t, char8_t, mbstate_t>}
2441+
convert between the UTF-32 and UTF-8 encoding forms.
24352442

24362443
\rSec1[depr.fs.path.factory]{Deprecated filesystem path factory functions}
24372444

source/iostreams.tex

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3513,6 +3513,11 @@
35133513
\end{itemdecl}
35143514

35153515
\begin{itemdescr}
3516+
\pnum
3517+
\expects
3518+
\range{gbeg}{gnext}, \range{gbeg}{gend}, and \range{gnext}{gend}
3519+
are all valid ranges.
3520+
35163521
\pnum
35173522
\ensures
35183523
\tcode{gbeg == eback()},
@@ -3573,6 +3578,10 @@
35733578
\end{itemdecl}
35743579

35753580
\begin{itemdescr}
3581+
\pnum
3582+
\expects
3583+
\range{pbeg}{pend} is a valid range.
3584+
35763585
\pnum
35773586
\ensures
35783587
\tcode{pbeg == pbase()},

source/locales.tex

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,6 @@
320320
collate & \tcode{collate<char>}, \tcode{collate<wchar_t>} \\ \rowsep
321321
ctype & \tcode{ctype<char>}, \tcode{ctype<wchar_t>} \\
322322
& \tcode{codecvt<char, char, mbstate_t>} \\
323-
& \tcode{codecvt<char16_t, char8_t, mbstate_t>} \\
324-
& \tcode{codecvt<char32_t, char8_t, mbstate_t>} \\
325323
& \tcode{codecvt<wchar_t, char, mbstate_t>} \\ \rowsep
326324
monetary & \tcode{moneypunct<char>}, \tcode{moneypunct<wchar_t>} \\
327325
& \tcode{moneypunct<char, true>}, \tcode{moneypunct<wchar_t, true>} \\
@@ -356,8 +354,6 @@
356354
collate & \tcode{collate_byname<char>}, \tcode{collate_byname<wchar_t>} \\ \rowsep
357355
ctype & \tcode{ctype_byname<char>}, \tcode{ctype_byname<wchar_t>} \\
358356
& \tcode{codecvt_byname<char, char, mbstate_t>} \\
359-
& \tcode{codecvt_byname<char16_t, char8_t, mbstate_t>} \\
360-
& \tcode{codecvt_byname<char32_t, char8_t, mbstate_t>} \\
361357
& \tcode{codecvt_byname<wchar_t, char, mbstate_t>} \\ \rowsep
362358
monetary & \tcode{moneypunct_byname<char, International>} \\
363359
& \tcode{moneypunct_byname<wchar_t, International>} \\
@@ -978,18 +974,18 @@
978974
using mask = @\seebelow@;
979975

980976
// numeric values are for exposition only.
981-
static const mask space = 1 << 0;
982-
static const mask print = 1 << 1;
983-
static const mask cntrl = 1 << 2;
984-
static const mask upper = 1 << 3;
985-
static const mask lower = 1 << 4;
986-
static const mask alpha = 1 << 5;
987-
static const mask digit = 1 << 6;
988-
static const mask punct = 1 << 7;
989-
static const mask xdigit = 1 << 8;
990-
static const mask blank = 1 << 9;
991-
static const mask alnum = alpha | digit;
992-
static const mask graph = alnum | punct;
977+
static constexpr mask space = 1 << 0;
978+
static constexpr mask print = 1 << 1;
979+
static constexpr mask cntrl = 1 << 2;
980+
static constexpr mask upper = 1 << 3;
981+
static constexpr mask lower = 1 << 4;
982+
static constexpr mask alpha = 1 << 5;
983+
static constexpr mask digit = 1 << 6;
984+
static constexpr mask punct = 1 << 7;
985+
static constexpr mask xdigit = 1 << 8;
986+
static constexpr mask blank = 1 << 9;
987+
static constexpr mask alnum = alpha | digit;
988+
static constexpr mask graph = alnum | punct;
993989
};
994990
}
995991
\end{codeblock}
@@ -1684,13 +1680,6 @@
16841680
convert the implementation-defined native character set.
16851681
\tcode{codecvt<char, char, mbstate_t>} implements a degenerate conversion;
16861682
it does not convert at all.
1687-
\indextext{UTF-8}%
1688-
\indextext{UTF-16}%
1689-
\indextext{UTF-32}%
1690-
The specialization \tcode{codecvt<char16_t, char8_t, mbstate_t>}
1691-
converts between the UTF-16 and UTF-8 encoding forms, and
1692-
the specialization \tcode{codecvt<char32_t, char8_t, mbstate_t>}
1693-
converts between the UTF-32 and UTF-8 encoding forms.
16941683
\tcode{codecvt<wchar_t, char, mbstate_t>}
16951684
converts between the native character sets for ordinary and wide characters.
16961685
Specializations on \tcode{mbstate_t}
@@ -4751,6 +4740,7 @@
47514740
The set of aliases of a known registered character encoding is an
47524741
\impldef{set of aliases of a known registered character encoding}
47534742
superset of the aliases specified in the IANA Character Sets registry.
4743+
The set of aliases for US-ASCII includes ``ASCII''.
47544744
No two aliases or primary names of distinct registered character encodings
47554745
are equivalent when compared by \tcode{text_encoding::\exposid{comp-name}}.
47564746

@@ -5073,6 +5063,11 @@
50735063
\tcode{ranges::range_value_t<text_encoding::aliases_view>} and
50745064
\tcode{ranges::range_reference_t<text_encoding::aliases_view>}
50755065
denote \tcode{const char*}.
5066+
5067+
\pnum
5068+
%FIXME: Is this supposed to be a remark or a requirement? Same above?
5069+
\tcode{ranges::iterator_t<text_encoding::aliases_view>}
5070+
is a constexpr iterator\iref{iterator.requirements.general}.
50765071
\end{itemdescr}
50775072

50785073
\rSec3[text.encoding.id]{Enumeration \tcode{text_encoding::id}}

source/ranges.tex

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,25 +2248,33 @@
22482248
\end{codeblock}
22492249

22502250
\pnum
2251-
Let \exposid{container-insertable} be defined as follows:
2251+
Let \exposid{container-appendable} be defined as follows:
22522252
\begin{codeblock}
22532253
template<class Container, class Ref>
2254-
constexpr bool @\exposid{container-insertable}@ = // \expos
2254+
constexpr bool @\exposid{container-appendable}@ = // \expos
22552255
requires(Container& c, Ref&& ref) {
2256-
requires (requires { c.push_back(std::forward<Ref>(ref)); } ||
2256+
requires (requires { c.emplace_back(std::forward<Ref>(ref)); } ||
2257+
requires { c.push_back(std::forward<Ref>(ref)); } ||
2258+
requires { c.emplace(c.end(), std::forward<Ref>(ref)); } ||
22572259
requires { c.insert(c.end(), std::forward<Ref>(ref)); });
22582260
};
22592261
\end{codeblock}
22602262

22612263
\pnum
2262-
Let \exposid{container-inserter} be defined as follows:
2264+
Let \exposid{container-appendable} be defined as follows:
22632265
\begin{codeblock}
22642266
template<class Ref, class Container>
2265-
constexpr auto @\exposid{container-inserter}@(Container& c) { // \expos
2266-
if constexpr (requires { c.push_back(declval<Ref>()); })
2267-
return back_inserter(c);
2268-
else
2269-
return inserter(c, c.end());
2267+
constexpr auto @\exposid{container-appendable}@(Container& c) { // \expos
2268+
return [&c]<class Ref>(Ref&& ref) {
2269+
if constexpr (requires { c.emplace_back(declval<Ref>()); })
2270+
c.emplace_back(std::forward<Ref>(ref));
2271+
else if constexpr (requires { c.push_back(declval<Ref>()); })
2272+
c.push_back(std::forward<Ref>(ref));
2273+
else if constexpr (requires { c.emplace(c.end(), declval<Ref>()); })
2274+
c.emplace(c.end(), std::forward<Ref>(ref));
2275+
else
2276+
c.insert(c.end(), std::forward<Ref>(ref));
2277+
};
22702278
}
22712279
\end{codeblock}
22722280

@@ -2328,13 +2336,13 @@
23282336
\item
23292337
\tcode{\libconcept{constructible_from}<C, Args...>} is \tcode{true}, and
23302338
\item
2331-
\tcode{\exposid{container-insertable}<C, range_reference_t<R>>} is \tcode{true}:
2339+
\tcode{\exposid{container-appendable}<C, range_reference_t<R>>} is \tcode{true}:
23322340
\end{itemize}
23332341
\begin{codeblock}
23342342
C c(std::forward<Args>(args)...);
23352343
if constexpr (@\libconcept{sized_range}@<R> && @\exposid{reservable-container}@<C>)
23362344
c.reserve(static_cast<range_size_t<C>>(ranges::size(r)));
2337-
ranges::copy(r, @\exposid{container-inserter}@<range_reference_t<R>>(c));
2345+
ranges::for_each(r, @\exposid{container-append}@(c));
23382346
\end{codeblock}
23392347
\item
23402348
Otherwise, the program is ill-formed.
@@ -2344,7 +2352,7 @@
23442352
Otherwise,
23452353
if \tcode{\libconcept{input_range}<range_reference_t<R>>} is \tcode{true}:
23462354
\begin{codeblock}
2347-
to<C>(r | views::transform([](auto&& elem) {
2355+
to<C>(ref_view(r) | views::transform([](auto&& elem) {
23482356
return to<range_value_t<C>>(std::forward<decltype(elem)>(elem));
23492357
}), std::forward<Args>(args)...);
23502358
\end{codeblock}
@@ -2533,6 +2541,7 @@
25332541
constexpr const T* begin() const noexcept;
25342542
constexpr T* end() noexcept;
25352543
constexpr const T* end() const noexcept;
2544+
static constexpr bool empty() noexcept;
25362545
static constexpr size_t size() noexcept;
25372546
constexpr T* data() noexcept;
25382547
constexpr const T* data() const noexcept;
@@ -2603,6 +2612,17 @@
26032612
Equivalent to: \tcode{return data() + 1;}
26042613
\end{itemdescr}
26052614

2615+
\indexlibrarymember{empty}{single_view}%
2616+
\begin{itemdecl}
2617+
static constexpr bool empty() noexcept;
2618+
\end{itemdecl}
2619+
2620+
\begin{itemdescr}
2621+
\pnum
2622+
\effects
2623+
Equivalent to: \tcode{return false;}
2624+
\end{itemdescr}
2625+
26062626
\indexlibrarymember{size}{single_view}%
26072627
\begin{itemdecl}
26082628
static constexpr size_t size() noexcept;
@@ -3406,7 +3426,7 @@
34063426
Given subexpressions \tcode{E} and \tcode{F},
34073427
the expressions \tcode{views::repeat(E)} and \tcode{views::repeat(E, F)}
34083428
are expression-equivalent to
3409-
\tcode{repeat_view(E)} and \tcode{repeat_view(E, F)}, respectively.
3429+
\tcode{repeat_view<decay_t<decltype((E))>>(E)} and \tcode{repeat_view(E, F)}, respectively.
34103430

34113431
\pnum
34123432
\begin{example}
@@ -3456,8 +3476,8 @@
34563476
constexpr auto size() const requires (!@\libconcept{same_as}@<Bound, unreachable_sentinel_t>);
34573477
};
34583478

3459-
template<class T, class Bound>
3460-
repeat_view(T, Bound) -> repeat_view<T, Bound>;
3479+
template<class T, class Bound = unreachable_sentinel_t>
3480+
repeat_view(T, Bound = Bound()) -> repeat_view<T, Bound>;
34613481
}
34623482
\end{codeblock}
34633483

@@ -7909,10 +7929,9 @@
79097929
private:
79107930
@\exposid{outer-iterator}@ @\exposid{i_}@ = @\exposid{outer-iterator}@(); // \expos
79117931

7912-
public:
7913-
value_type() = default;
7914-
constexpr explicit value_type(@\exposid{outer-iterator}@ i);
7932+
constexpr explicit value_type(@\exposid{outer-iterator}@ i); // \expos
79157933

7934+
public:
79167935
constexpr @\exposid{inner-iterator}@<Const> begin() const;
79177936
constexpr default_sentinel_t end() const noexcept;
79187937
};
@@ -8542,7 +8561,7 @@
85428561
constexpr V base() const & requires @\libconcept{copy_constructible}@<V> { return @\exposid{base_}@; }
85438562
constexpr V base() && { return std::move(@\exposid{base_}@); }
85448563

8545-
constexpr auto begin() {
8564+
constexpr auto begin() requires (!@\exposconcept{simple-view}@<V>) {
85468565
if constexpr (@\libconcept{random_access_range}@<V> && @\libconcept{sized_range}@<V>)
85478566
return ranges::begin(@\exposid{base_}@);
85488567
else
@@ -8556,7 +8575,7 @@
85568575
return common_iterator<iterator_t<const V>, sentinel_t<const V>>(ranges::begin(@\exposid{base_}@));
85578576
}
85588577

8559-
constexpr auto end() {
8578+
constexpr auto end() requires (!@\exposconcept{simple-view}@<V>) {
85608579
if constexpr (@\libconcept{random_access_range}@<V> && @\libconcept{sized_range}@<V>)
85618580
return ranges::begin(@\exposid{base_}@) + ranges::distance(@\exposid{base_}@);
85628581
else
@@ -9539,13 +9558,13 @@
95399558
{ return @\exposid{iterator}@<true>(ranges::begin(@\exposid{base_}@), 0); }
95409559

95419560
constexpr auto end() requires (!@\exposconcept{simple-view}@<V>) {
9542-
if constexpr (@\libconcept{common_range}@<V> && @\libconcept{sized_range}@<V>)
9561+
if constexpr (@\libconcept{forward_range}@<V> && @\libconcept{common_range}@<V> && @\libconcept{sized_range}@<V>)
95439562
return @\exposid{iterator}@<false>(ranges::end(@\exposid{base_}@), ranges::distance(@\exposid{base_}@));
95449563
else
95459564
return @\exposid{sentinel}@<false>(ranges::end(@\exposid{base_}@));
95469565
}
95479566
constexpr auto end() const requires @\exposconcept{range-with-movable-references}@<const V> {
9548-
if constexpr (@\libconcept{common_range}@<const V> && @\libconcept{sized_range}@<const V>)
9567+
if constexpr (@\libconcept{forward_range}@<const V> && @\libconcept{common_range}@<const V> && @\libconcept{sized_range}@<const V>)
95499568
return @\exposid{iterator}@<true>(ranges::end(@\exposid{base_}@), ranges::distance(@\exposid{base_}@));
95509569
else
95519570
return @\exposid{sentinel}@<true>(ranges::end(@\exposid{base_}@));

0 commit comments

Comments
 (0)