diff --git a/source/compatibility.tex b/source/compatibility.tex index 95ce283019..b9f1b4dc8f 100644 --- a/source/compatibility.tex +++ b/source/compatibility.tex @@ -818,30 +818,6 @@ Valid \CppXX{} code that instantiated the removed specialization can become ill-formed. -\rSec2[diff.cpp20.strings]{\ref*{strings}: strings library} - -\diffref{string.classes} -\change -Additional rvalue overload for the \tcode{substr} member function and -the corresponding constructor. -\rationale -Improve efficiency of operations on rvalues. -\effect -Valid \CppXX{} code that created a substring -by calling \tcode{substr} (or the corresponding constructor) -on an xvalue expression with type \tcode{S} -that is a specialization of \tcode{basic_string} -may change meaning in this revision of \Cpp{}. -\begin{example} -\begin{codeblock} -std::string s1 = "some long string that forces allocation", s2 = s1; -std::move(s1).substr(10, 5); -assert(s1 == s2); // unspecified, previously guaranteed to be \tcode{true} -std::string s3(std::move(s2), 10, 5); -assert(s1 == s2); // unspecified, previously guaranteed to be \tcode{true} -\end{codeblock} -\end{example} - \rSec2[diff.cpp20.containers]{\ref*{containers}: containers library} \diffref{associative.reqmts,unord.req} @@ -866,6 +842,30 @@ \end{codeblock} \end{example} +\rSec2[diff.cpp20.strings]{\ref*{strings}: strings library} + +\diffref{string.classes} +\change +Additional rvalue overload for the \tcode{substr} member function and +the corresponding constructor. +\rationale +Improve efficiency of operations on rvalues. +\effect +Valid \CppXX{} code that created a substring +by calling \tcode{substr} (or the corresponding constructor) +on an xvalue expression with type \tcode{S} +that is a specialization of \tcode{basic_string} +may change meaning in this revision of \Cpp{}. +\begin{example} +\begin{codeblock} +std::string s1 = "some long string that forces allocation", s2 = s1; +std::move(s1).substr(10, 5); +assert(s1 == s2); // unspecified, previously guaranteed to be \tcode{true} +std::string s3(std::move(s2), 10, 5); +assert(s1 == s2); // unspecified, previously guaranteed to be \tcode{true} +\end{codeblock} +\end{example} + \rSec2[diff.cpp20.thread]{\ref*{thread}: concurrency support library} \diffref{thread.barrier} @@ -1944,30 +1944,6 @@ \end{codeblock} \end{example} -\rSec2[diff.cpp14.string]{\ref*{strings}: strings library} - -\diffref{basic.string} -\change -Non-const \tcode{.data()} member added. -\rationale -The lack of a non-const \tcode{.data()} -differed from the similar member of \tcode{std::vector}. -This change regularizes behavior. -\effect -Overloaded functions which have differing code paths -for \tcode{char*} and \tcode{const char*} arguments -will execute differently -when called with a non-const string's \tcode{.data()} member -in this revision of \Cpp{}. -\begin{example} -\begin{codeblock} -int f(char *) = delete; -int f(const char *); -string s; -int x = f(s.data()); // ill-formed; previously well-formed -\end{codeblock} -\end{example} - \rSec2[diff.cpp14.containers]{\ref*{containers}: containers library} \diffref{associative.reqmts} @@ -1998,6 +1974,30 @@ \end{codeblock} \end{example} +\rSec2[diff.cpp14.string]{\ref*{strings}: strings library} + +\diffref{basic.string} +\change +Non-const \tcode{.data()} member added. +\rationale +The lack of a non-const \tcode{.data()} +differed from the similar member of \tcode{std::vector}. +This change regularizes behavior. +\effect +Overloaded functions which have differing code paths +for \tcode{char*} and \tcode{const char*} arguments +will execute differently +when called with a non-const string's \tcode{.data()} member +in this revision of \Cpp{}. +\begin{example} +\begin{codeblock} +int f(char *) = delete; +int f(const char *); +string s; +int x = f(s.data()); // ill-formed; previously well-formed +\end{codeblock} +\end{example} + \rSec2[diff.cpp14.depr]{\ref*{depr}: compatibility features} \nodiffref @@ -2604,28 +2604,6 @@ \tcode{unary_function} or \tcode{binary_function} may fail to compile in this revision of \Cpp{}. -\rSec2[diff.cpp03.strings]{\ref*{strings}: strings library} - -\diffref{string.classes} -\change -\tcode{basic_string} requirements no longer allow reference-counted -strings. -\rationale -Invalidation is subtly different with reference-counted strings. -This change regularizes behavior. -\effect -Valid \CppIII{} code may execute differently in this revision of \Cpp{}. - -\diffref{string.require} -\change -Loosen \tcode{basic_string} invalidation rules. -\rationale -Allow small-string optimization. -\effect -Valid \CppIII{} code may execute differently in this revision of \Cpp{}. -Some \keyword{const} member functions, such as \tcode{data} and \tcode{c_str}, -no longer invalidate iterators. - \rSec2[diff.cpp03.containers]{\ref*{containers}: containers library} \diffref{container.requirements} @@ -2732,19 +2710,29 @@ \tcode{std::remove_if} may leave the tail of the input sequence with a different set of values than previously. -\rSec2[diff.cpp03.numerics]{\ref*{numerics}: numerics library} +\rSec2[diff.cpp03.strings]{\ref*{strings}: strings library} -\diffref{complex.numbers} +\diffref{string.classes} \change -Specified representation of complex numbers. +\tcode{basic_string} requirements no longer allow reference-counted +strings. \rationale -Compatibility with C99. +Invalidation is subtly different with reference-counted strings. +This change regularizes behavior. \effect -Valid \CppIII{} code that uses implementation-specific knowledge about the -binary representation of the required template specializations of -\tcode{std::complex} may not be compatible with this revision of \Cpp{}. +Valid \CppIII{} code may execute differently in this revision of \Cpp{}. + +\diffref{string.require} +\change +Loosen \tcode{basic_string} invalidation rules. +\rationale +Allow small-string optimization. +\effect +Valid \CppIII{} code may execute differently in this revision of \Cpp{}. +Some \keyword{const} member functions, such as \tcode{data} and \tcode{c_str}, +no longer invalidate iterators. -\rSec2[diff.cpp03.locale]{\ref*{localization}: localization library} +\rSec2[diff.cpp03.locale]{\ref*{text}: text processing library} \diffref{facet.num.get.virtuals} \change @@ -2754,6 +2742,18 @@ \effect Valid \CppIII{} code may have different behavior in this revision of \Cpp{}. +\rSec2[diff.cpp03.numerics]{\ref*{numerics}: numerics library} + +\diffref{complex.numbers} +\change +Specified representation of complex numbers. +\rationale +Compatibility with C99. +\effect +Valid \CppIII{} code that uses implementation-specific knowledge about the +binary representation of the required template specializations of +\tcode{std::complex} may not be compatible with this revision of \Cpp{}. + \rSec2[diff.cpp03.input.output]{\ref*{input.output}: input/output library} \diffref{istream.sentry,ostream.sentry,iostate.flags}