From 4291427222a77f35d26f03f262b7b73db2384866 Mon Sep 17 00:00:00 2001 From: Alisdair Meredith Date: Mon, 23 Jun 2025 05:57:36 -0400 Subject: [PATCH 1/2] P2319R5 Prevent path presentation problems Fixes #7967 Fixes cplusplus/papers#1987 --- source/future.tex | 39 +++++++++++++++++++++++++++++++++++++++ source/iostreams.tex | 43 +++++++++++++++++++++++++++++++++++++------ source/support.tex | 2 +- 3 files changed, 77 insertions(+), 7 deletions(-) diff --git a/source/future.tex b/source/future.tex index 50edea0be7..8ba1a1fa80 100644 --- a/source/future.tex +++ b/source/future.tex @@ -841,6 +841,45 @@ \end{note} \end{itemdescr} +\rSec1[depr.fs.path.obs]{Deprecated filesystem path format observers} + +\indexlibraryglobal{path}% +\pnum +The following members are declared in addition to those members specified in +\iref{fs.path.member}: + +\begin{codeblock} +namespace std::filesystem { + class path { + public: + std::string string() const; + std::string generic_string() const; + }; +} +\end{codeblock} + +\indexlibrarymember{string}{path}% +\begin{itemdecl} +std::string string() const; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\returns +\tcode{system_encoded_string()}. +\end{itemdescr} + +\indexlibrarymember{generic_string}{path}% +\begin{itemdecl} +std::string generic_string() const; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\returns +\tcode{generic_system_encoded_string()}. +\end{itemdescr} + \rSec1[depr.atomics]{Deprecated atomic operations} \rSec2[depr.atomics.general]{General} diff --git a/source/iostreams.tex b/source/iostreams.tex index 3f925b2b28..63041e8457 100644 --- a/source/iostreams.tex +++ b/source/iostreams.tex @@ -13707,7 +13707,8 @@ class Allocator = allocator> basic_string string(const Allocator& a = Allocator()) const; - std::string string() const; + std::string display_string() const; + std::string system_encoded_string() const; std::wstring wstring() const; std::u8string u8string() const; std::u16string u16string() const; @@ -13718,7 +13719,8 @@ class Allocator = allocator> basic_string generic_string(const Allocator& a = Allocator()) const; - std::string generic_string() const; + std::string generic_display_string() const; + std::string generic_system_encoded_string() const; std::wstring generic_wstring() const; std::u8string generic_u8string() const; std::u16string generic_u16string() const; @@ -14689,13 +14691,13 @@ \ref{fs.path.cvt}. \end{itemdescr} -\indexlibrarymember{string}{path}% +\indexlibrarymember{system_encoded_string}{path}% \indexlibrarymember{wstring}{path}% \indexlibrarymember{u8string}{path}% \indexlibrarymember{u16string}{path}% \indexlibrarymember{u32string}{path}% \begin{itemdecl} -std::string string() const; +std::string system_encoded_string() const; std::wstring wstring() const; std::u8string u8string() const; std::u16string u16string() const; @@ -14713,6 +14715,20 @@ by \ref{fs.path.cvt}. \end{itemdescr} +\indexlibrarymember{display_string}{path}% +\begin{itemdecl} +std::string display_string() const; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\returns +\tcode{format("{}", *this)}. +\begin{note} +The returned string is suitable for use with formatting \iref{format.functions} +and print functions \iref{print.fun}. +\end{note} +\end{itemdescr} \rSec4[fs.path.generic.obs]{Generic format observers} @@ -14752,13 +14768,13 @@ \ref{fs.path.cvt}. \end{itemdescr} -\indexlibrarymember{generic_string}{path}% +\indexlibrarymember{generic_system_encoded_string}{path}% \indexlibrarymember{generic_wstring}{path}% \indexlibrarymember{generic_u8string}{path}% \indexlibrarymember{generic_u16string}{path}% \indexlibrarymember{generic_u32string}{path}% \begin{itemdecl} -std::string generic_string() const; +std::string generic_system_encoded_string() const; std::wstring generic_wstring() const; std::u8string generic_u8string() const; std::u16string generic_u16string() const; @@ -14775,6 +14791,21 @@ Conversion, if any, is specified by~\ref{fs.path.cvt}. \end{itemdescr} +\indexlibrarymember{generic_display_string}{path}% +\begin{itemdecl} +std::string generic_display_string() const; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\returns +\tcode{format("{:g}", *this)}. +\begin{note} +The returned string is suitable for use with formatting \iref{format.functions} +and print functions \iref{print.fun}. +\end{note} +\end{itemdescr} + \rSec4[fs.path.compare]{Compare} \indexlibrarymember{compare}{path}% diff --git a/source/support.tex b/source/support.tex index 95d674aafb..3a719f43aa 100644 --- a/source/support.tex +++ b/source/support.tex @@ -660,7 +660,7 @@ #define @\defnlibxname{cpp_lib_flat_set}@ 202207L // also in \libheader{flat_set} #define @\defnlibxname{cpp_lib_format}@ 202311L // also in \libheader{format} #define @\defnlibxname{cpp_lib_format_ranges}@ 202207L // also in \libheader{format} -#define @\defnlibxname{cpp_lib_format_path}@ 202403L // also in \libheader{filesystem} +#define @\defnlibxname{cpp_lib_format_path}@ 202506L // also in \libheader{filesystem} #define @\defnlibxname{cpp_lib_format_uchar}@ 202311L // also in \libheader{format} #define @\defnlibxname{cpp_lib_formatters}@ 202302L // also in \libheader{stacktrace}, \libheader{thread} #define @\defnlibxname{cpp_lib_forward_like}@ 202207L // freestanding, also in \libheader{utility} From c18e7a99273e5d378288cadf3dc55cb6bd27def1 Mon Sep 17 00:00:00 2001 From: Alisdair Meredith Date: Mon, 23 Jun 2025 06:07:45 -0400 Subject: [PATCH 2/2] [depr.filesystems] Introduced section to group filesystems deprecations --- source/future.tex | 6 ++++-- source/iostreams.tex | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/future.tex b/source/future.tex index 8ba1a1fa80..e88d27ff79 100644 --- a/source/future.tex +++ b/source/future.tex @@ -762,7 +762,9 @@ Equivalent to: \tcode{return visit(std::forward(vis), arg.value);} \end{itemdescr} -\rSec1[depr.fs.path.factory]{Deprecated filesystem path factory functions} +\rSec1[depr.filesystems]{Deprecated file systems} + +\rSec2[depr.fs.path.factory]{Deprecated filesystem path factory functions} \pnum The header \libheaderrefx{filesystem}{fs.filesystem.syn} has the following additions: @@ -841,7 +843,7 @@ \end{note} \end{itemdescr} -\rSec1[depr.fs.path.obs]{Deprecated filesystem path format observers} +\rSec2[depr.fs.path.obs]{Deprecated filesystem path format observers} \indexlibraryglobal{path}% \pnum diff --git a/source/iostreams.tex b/source/iostreams.tex index 63041e8457..b7d8377eb8 100644 --- a/source/iostreams.tex +++ b/source/iostreams.tex @@ -14725,8 +14725,8 @@ \returns \tcode{format("{}", *this)}. \begin{note} -The returned string is suitable for use with formatting \iref{format.functions} -and print functions \iref{print.fun}. +The returned string is suitable for use with formatting\iref{format.functions} +and print functions\iref{print.fun}. \end{note} \end{itemdescr} @@ -14801,8 +14801,8 @@ \returns \tcode{format("{:g}", *this)}. \begin{note} -The returned string is suitable for use with formatting \iref{format.functions} -and print functions \iref{print.fun}. +The returned string is suitable for use with formatting\iref{format.functions} +and print functions\iref{print.fun}. \end{note} \end{itemdescr}