Skip to content

Commit bff0d08

Browse files
authored
Merge 2023-11 LWG Motion 13
P2871R3 Remove deprecated <codecvt> header
2 parents 8ea5a81 + 0792344 commit bff0d08

File tree

4 files changed

+41
-129
lines changed

4 files changed

+41
-129
lines changed

source/compatibility.tex

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,29 @@
166166
The old functionality can be achieved by calling \tcode{shrink_to_fit()} instead,
167167
or the function call can be safely eliminated with no side effects.
168168

169+
\nodiffref
170+
\change
171+
Remove header \libnoheader{codecvt} and all its contents.
172+
\rationale
173+
The header has been deprecated for the previous three editions of this standard
174+
and no longer implements the current Unicode standard, supporting only the
175+
obsolete UCS-2 encoding.
176+
Ongoing support is at implementer's discretion,
177+
exercising freedoms granted by \ref{zombie.names}.
178+
\effect
179+
A valid \CppXXIII{} program \tcode{\#include}-ing the header or importing the
180+
header unit may fail to compile. Code that uses any of the following names by
181+
importing the standard library modules may fail to compile:
182+
\begin{itemize}
183+
\item \tcode{codecvt_mode},
184+
\item \tcode{codecvt_utf16},
185+
\item \tcode{codecvt_utf8},
186+
\item \tcode{codecvt_utf8_utf16},
187+
\item \tcode{consume_header},
188+
\item \tcode{generate_header}, and
189+
\item \tcode{little_endian}.
190+
\end{itemize}
191+
169192
\rSec1[diff.cpp20]{\Cpp{} and ISO \CppXX{}}
170193

171194
\rSec2[diff.cpp20.general]{General}
@@ -2039,11 +2062,10 @@
20392062
\libheaderref{array},
20402063
\libheaderrefx{atomic}{atomics.syn},
20412064
\libheaderrefx{chrono}{time.syn},
2042-
\libdeprheaderref{codecvt},
20432065
\libheaderrefx{condition_variable}{condition.variable.syn},
20442066
\libheaderrefx{forward_list}{forward.list.syn},
20452067
\libheaderref{future},
2046-
\libheaderrefx{initializer_list}{initializer.list.syn},
2068+
\libheaderrefx{initiali\-zer_list}{initializer.list.syn},
20472069
\libheaderref{mutex},
20482070
\libheaderrefx{random}{rand.synopsis},
20492071
\libheaderref{ratio},

source/future.tex

Lines changed: 3 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,129 +2023,6 @@
20232023
Equivalent to: \tcode{return visit(std::forward<Visitor>(vis), arg.value);}
20242024
\end{itemdescr}
20252025

2026-
\rSec1[depr.locale.stdcvt]{Deprecated standard code conversion facets}
2027-
2028-
\rSec2[depr.locale.stdcvt.general]{General}
2029-
2030-
\pnum
2031-
The header \libheaderdef{codecvt} provides
2032-
code conversion facets for various character encodings.
2033-
2034-
\rSec2[depr.codecvt.syn]{Header \tcode{<codecvt>} synopsis}
2035-
2036-
\indexlibraryglobal{codecvt_mode}%
2037-
\indexlibraryglobal{codecvt_utf8}%
2038-
\indexlibraryglobal{codecvt_utf16}%
2039-
\indexlibraryglobal{codecvt_utf8_utf16}%
2040-
\begin{codeblock}
2041-
namespace std {
2042-
enum codecvt_mode {
2043-
consume_header = 4,
2044-
generate_header = 2,
2045-
little_endian = 1
2046-
};
2047-
2048-
template<class Elem, unsigned long Maxcode = 0x10ffff, codecvt_mode Mode = (codecvt_mode)0>
2049-
class codecvt_utf8 : public codecvt<Elem, char, mbstate_t> {
2050-
public:
2051-
explicit codecvt_utf8(size_t refs = 0);
2052-
~codecvt_utf8();
2053-
};
2054-
2055-
template<class Elem, unsigned long Maxcode = 0x10ffff, codecvt_mode Mode = (codecvt_mode)0>
2056-
class codecvt_utf16 : public codecvt<Elem, char, mbstate_t> {
2057-
public:
2058-
explicit codecvt_utf16(size_t refs = 0);
2059-
~codecvt_utf16();
2060-
};
2061-
2062-
template<class Elem, unsigned long Maxcode = 0x10ffff, codecvt_mode Mode = (codecvt_mode)0>
2063-
class codecvt_utf8_utf16 : public codecvt<Elem, char, mbstate_t> {
2064-
public:
2065-
explicit codecvt_utf8_utf16(size_t refs = 0);
2066-
~codecvt_utf8_utf16();
2067-
};
2068-
}
2069-
\end{codeblock}
2070-
2071-
\rSec2[depr.locale.stdcvt.req]{Requirements}
2072-
2073-
\pnum
2074-
For each of the three code conversion facets \tcode{codecvt_utf8},
2075-
\tcode{codecvt_utf16}, and \tcode{codecvt_utf8_utf16}:
2076-
\begin{itemize}
2077-
\item
2078-
\tcode{Elem} is one of
2079-
\keyword{wchar_t}, \keyword{char16_t}, or \keyword{char32_t}.
2080-
\item
2081-
\tcode{Maxcode} is the largest value of \tcode{Elem}
2082-
converted to \tcode{\keyword{unsigned} \keyword{long}}
2083-
that the facet
2084-
will read or write without reporting a conversion error.
2085-
\item
2086-
If \tcode{(Mode \& consume_header)}, the facet shall consume an
2087-
initial header sequence, if present, when reading a multibyte sequence
2088-
to determine the endianness of the subsequent multibyte sequence to be read.
2089-
\item
2090-
If \tcode{(Mode \& generate_header)}, the facet shall generate an
2091-
initial header sequence when writing a multibyte sequence to advertise
2092-
the endianness of the subsequent multibyte sequence to be written.
2093-
\item
2094-
If \tcode{(Mode \& little_endian)}, the facet shall generate a
2095-
multibyte sequence in little-endian order,
2096-
as opposed to the default big-endian order.
2097-
\item
2098-
UCS-2 is the same encoding as UTF-16,
2099-
except that it encodes scalar values in the range
2100-
\ucode{0000}--\ucode{ffff} (Basic Multilingual Plane) only.
2101-
\end{itemize}
2102-
2103-
\pnum
2104-
\indextext{UTF-8}%
2105-
\indextext{UCS-2}%
2106-
\indextext{UTF-32}%
2107-
For the facet \tcode{codecvt_utf8}\indexlibraryglobal{codecvt_utf8}:
2108-
\begin{itemize}
2109-
\item
2110-
The facet shall convert between UTF-8 multibyte sequences
2111-
and UCS-2 or UTF-32 (depending on the size of \tcode{Elem}).
2112-
\item
2113-
Endianness shall not affect how multibyte sequences are read or written.
2114-
\item
2115-
The multibyte sequences may be written as either a text or a binary file.
2116-
\end{itemize}
2117-
2118-
\pnum
2119-
\indextext{UTF-16}%
2120-
\indextext{UCS-2}%
2121-
\indextext{UTF-32}%
2122-
For the facet \tcode{codecvt_utf16}\indexlibraryglobal{codecvt_utf16}:
2123-
\begin{itemize}
2124-
\item
2125-
The facet shall convert between UTF-16 multibyte sequences
2126-
and UCS-2 or UTF-32 (depending on the size of \tcode{Elem}).
2127-
\item
2128-
Multibyte sequences shall be read or written
2129-
according to the \tcode{Mode} flag, as set out above.
2130-
\item
2131-
The multibyte sequences may be written only as a binary file.
2132-
Attempting to write to a text file produces undefined behavior.
2133-
\end{itemize}
2134-
2135-
\pnum
2136-
\indextext{UTF-8}%
2137-
\indextext{UTF-16}%
2138-
For the facet \tcode{codecvt_utf8_utf16}\indexlibraryglobal{codecvt_utf8_utf16}:
2139-
\begin{itemize}
2140-
\item
2141-
The facet shall convert between UTF-8 multibyte sequences
2142-
and UTF-16 (one or two 16-bit codes) within the program.
2143-
\item
2144-
Endianness shall not affect how multibyte sequences are read or written.
2145-
\item
2146-
The multibyte sequences may be written as either a text or a binary file.
2147-
\end{itemize}
2148-
21492026
\rSec1[depr.conversions]{Deprecated convenience conversion interfaces}
21502027

21512028
\rSec2[depr.conversions.general]{General}
@@ -2174,12 +2051,12 @@
21742051
(like class template \tcode{codecvt}) to perform the conversions, without
21752052
affecting any streams or locales.
21762053
\begin{example}
2177-
If you want to use the code
2178-
conversion facet \tcode{codecvt_utf8} to output to \tcode{cout} a UTF-8
2054+
If you want to use a code
2055+
conversion facet, \tcode{codecvt_for_utf8}, to output to \tcode{cout} a UTF-8
21792056
multibyte sequence corresponding to a wide string, but you don't want to
21802057
alter the locale for \tcode{cout}, you can write something like:
21812058
\begin{codeblock}
2182-
std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
2059+
std::wstring_convert<codecvt_for_utf8<wchar_t>> myconv;
21832060
std::string mbstring = myconv.to_bytes(L"Hello\n");
21842061
std::cout << mbstring;
21852062
\end{codeblock}

source/lib-intro.tex

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,6 @@
11261126
\tcode{<bitset>} \\
11271127
\tcode{<charconv>} \\
11281128
\tcode{<chrono>} \\
1129-
\tcode{<codecvt>} \\
11301129
\tcode{<compare>} \\
11311130
\tcode{<complex>} \\
11321131
\tcode{<concepts>} \\
@@ -3028,18 +3027,25 @@
30283027
\item \indexlibraryzombie{bind2nd} \tcode{bind2nd},
30293028
\item \indexlibraryzombie{binder1st} \tcode{binder1st},
30303029
\item \indexlibraryzombie{binder2nd} \tcode{binder2nd},
3030+
\item \indexlibraryzombie{codecvt_mode} \tcode{codecvt_mode},
3031+
\item \indexlibraryzombie{codecvt_utf16} \tcode{codecvt_utf16},
3032+
\item \indexlibraryzombie{codecvt_utf8} \tcode{codecvt_utf8},
3033+
\item \indexlibraryzombie{codecvt_utf8_utf16} \tcode{codecvt_utf8_utf16},
30313034
\item \indexlibraryzombie{const_mem_fun1_ref_t} \tcode{const_mem_fun1_ref_t},
30323035
\item \indexlibraryzombie{const_mem_fun1_t} \tcode{const_mem_fun1_t},
30333036
\item \indexlibraryzombie{const_mem_fun_ref_t} \tcode{const_mem_fun_ref_t},
30343037
\item \indexlibraryzombie{const_mem_fun_t} \tcode{const_mem_fun_t},
3038+
\item \indexlibraryzombie{consume_header} \tcode{consume_header},
30353039
\item \indexlibraryzombie{declare_no_pointers} \tcode{declare_no_pointers},
30363040
\item \indexlibraryzombie{declare_reachable} \tcode{declare_reachable},
3041+
\item \indexlibraryzombie{generate_header} \tcode{generate_header},
30373042
\item \indexlibraryzombie{get_pointer_safety} \tcode{get_pointer_safety},
30383043
\item \indexlibraryzombie{get_temporary_buffer} \tcode{get_temporary_buffer},
30393044
\item \indexlibraryzombie{get_unexpected} \tcode{get_unexpected},
30403045
\item \indexlibraryzombie{gets} \tcode{gets},
30413046
\item \indexlibraryzombie{is_literal_type} \tcode{is_literal_type},
30423047
\item \indexlibraryzombie{is_literal_type_v} \tcode{is_literal_type_v},
3048+
\item \indexlibraryzombie{little_endian} \tcode{little_endian},
30433049
\item \indexlibraryzombie{mem_fun1_ref_t} \tcode{mem_fun1_ref_t},
30443050
\item \indexlibraryzombie{mem_fun1_t} \tcode{mem_fun1_t},
30453051
\item \indexlibraryzombie{mem_fun_ref_t} \tcode{mem_fun_ref_t},
@@ -3091,6 +3097,7 @@
30913097
The header names
30923098
\libnoheader{ccomplex},
30933099
\libnoheader{ciso646},
3100+
\libnoheader{codecvt},
30943101
\libnoheader{cstdalign},
30953102
\libnoheader{cstdbool}, and
30963103
\libnoheader{ctgmath}

source/xrefdelta.tex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
% P2864R2 Remove deprecated arithmetic conversions
2323
\removedxref{depr.arith.conv.enum}
2424

25+
% P2871R3 Remove deprecated <codecvt> header
26+
\removedxref{depr.codecvt.syn}
27+
\removedxref{depr.locale.stdcvt}
28+
\removedxref{depr.locale.stdcvt.general}
29+
\removedxref{depr.locale.stdcvt.req}
30+
2531
% P2870R3 Remove deprecated typedef from `std::allocator`
2632
\removedxref{depr.default.allocator}
2733

0 commit comments

Comments
 (0)