Proposed resolution:
At the end of 27.9.1 File streams [fstreams] add a paragraph:
In this subclause, member functions taking arguments of
const std::filesystem::path::value_type*
shall only be provided on systems
where std::filesystem::path::value_type
([fs.class.path]) is not
char
. [Note: These functions enable class path
support for systems with a wide native path character type, such as
wchar_t
. — end note]
Change 27.9.1.1 Class template basic_filebuf [filebuf] as indicated:
basic_filebuf<charT,traits>* open(const char* s, ios_base::openmode mode); basic_filebuf<charT,traits>* open(const std::filesystem::path::value_type* s, ios_base::openmode mode); // wide systems only; see [fstreams] basic_filebuf<charT,traits>* open(const string& s, ios_base::openmode mode); basic_filebuf<charT,traits>* open(const filesystem::path& p, ios_base::openmode mode);
Change 27.9.1.4 Member functions [filebuf.members] as indicated:
basic_filebuf<charT,traits>* open(const char* s, ios_base::openmode mode); basic_filebuf<charT,traits>* open(const std::filesystem::path::value_type* s, ios_base::openmode mode); // wide systems only; see [fstreams]
To 27.9.1.4 Member functions [filebuf.members] add:
basic_filebuf<charT,traits>* open(const filesystem::path& p, ios_base::openmode mode);
Returns:
open(p.c_str(), mode);
Change 27.9.1.6 Class template basic_ifstream [ifstream] as indicated:
explicit basic_ifstream(const char* s, ios_base::openmode mode = ios_base::in); explicit basic_ifstream(const std::filesystem::path::value_type* s, ios_base::openmode mode = ios_base::in); // wide systems only; see [fstreams] explicit basic_ifstream(const string& s, ios_base::openmode mode = ios_base::in); explicit basic_ifstream(const filesystem::path& p, ios_base::openmode mode = ios_base::in); ... void open(const char* s, ios_base::openmode mode = ios_base::in); void open(const std::filesystem::path::value_type* s, ios_base::openmode mode = ios_base::in); // wide systems only; see [fstreams] void open(const string& s, ios_base::openmode mode = ios_base::in); void open(const filesystem::path& p, ios_base::openmode mode = ios_base::in);
Change 27.9.1.7 basic_ifstream constructors [ifstream.cons] as indicated:
explicit basic_ifstream(const char* s, ios_base::openmode mode = ios_base::in); explicit basic_ifstream(const std::filesystem::path::value_type* s, ios_base::openmode mode = ios_base::in); // wide systems only; see [fstreams]
To 27.9.1.7 basic_ifstream constructors [ifstream.cons] add:
explicit basic_ifstream(const filesystem::path& p, ios_base::openmode mode = ios_base::in);
Effects: the same as
basic_ifstream(p.c_str(), mode)
.
Change 27.9.1.9 Member functions [ifstream.members] as indicated:
void open(const char* s, ios_base::openmode mode = ios_base::in); void open(const std::filesystem::path::value_type* s, ios_base::openmode mode = ios_base::in); // wide systems only; see [fstreams]
To 27.9.1.9 Member functions [ifstream.members] add:
void open(const filesystem::path& p, ios_base::openmode mode = ios_base::in);
Effects: calls
open(p.c_str(), mode)
.
Change 27.9.1.10 Class template basic_ofstream [ofstream] as indicated:
explicit basic_ofstream(const char* s, ios_base::openmode mode = ios_base::out); explicit basic_ofstream(const std::filesystem::path::value_type* s, ios_base::openmode mode = ios_base::out); // wide systems only; see [fstreams] explicit basic_ofstream(const string& s, ios_base::openmode mode = ios_base::out); explicit basic_ofstream(const filesystem::path& p, ios_base::openmode mode = ios_base::out); ... void open(const char* s, ios_base::openmode mode = ios_base::out); void open(const std::filesystem::path::value_type* s, ios_base::openmode mode = ios_base::out); // wide systems only; see [fstreams] void open(const string& s, ios_base::openmode mode = ios_base::out); void open(const filesystem::path& p, ios_base::openmode mode = ios_base::out);
Change 27.9.1.11 basic_ofstream constructors [ofstream.cons] as indicated:
explicit basic_ofstream(const char* s, ios_base::openmode mode = ios_base::out); explicit basic_ofstream(const std::filesystem::path::value_type* s, ios_base::openmode mode = ios_base::out); // wide systems only; see [fstreams]
To 27.9.1.11 basic_ofstream constructors [ofstream.cons] add:
explicit basic_ofstream(const filesystem::path& p, ios_base::openmode mode = ios_base::out);
Effects: the same as
basic_ofstream(p.c_str(), mode)
.
Change 27.9.1.13 Member functions [ofstream.members] as indicated:
void open(const char* s, ios_base::openmode mode = ios_base::out); void open(const std::filesystem::path::value_type* s, ios_base::openmode mode = ios_base::out); // wide systems only; see [fstreams]
To 27.9.1.13 Member functions [ofstream.members] add:
void open(const filesystem::path& p, ios_base::openmode mode = ios_base::out);
Effects: calls
open(p.c_str(), mode)
.
Change 27.9.1.14 Class template basic_fstream [fstream] as indicated:
explicit basic_fstream(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out); explicit basic_fstream(const std::filesystem::path::value_type* s, ios_base::openmode mode = ios_base::in|ios_base::out); // wide systems only; see [fstreams] explicit basic_fstream(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out); explicit basic_fstream(const filesystem::path& p, ios_base::openmode mode = ios_base::in|ios_base::out); ... void open(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out); void open(const std::filesystem::path::value_type* s, ios_base::openmode mode = ios_base::in|ios_base::out); // wide systems only; see [fstreams] void open(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out); void open(const filesystem::path& p, ios_base::openmode mode = ios_base::in|ios_base::out);
Change 27.9.1.15 basic_fstream constructors [fstream.cons] as indicated:
explicit basic_fstream(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out); explicit basic_fstream(const std::filesystem::path::value_type* s, ios_base::openmode mode = ios_base::in|ios_base::out); // wide systems only; see [fstreams]
To 27.9.1.15 basic_fstream constructors [fstream.cons] add:
explicit basic_fstream(const filesystem::path& p, ios_base::openmode mode = ios_base::in|ios_base::out);
Effects: the same as
basic_fstream(p.c_str(), mode)
.
Change 27.9.1.17 Member functions [fstream.members] as indicated:
void open(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out); void open(const std::filesystem::path::value_type* s, ios_base::openmode mode = ios_base::in|ios_base::out); // wide systems only; see [fstreams]
To 27.9.1.17 Member functions [fstream.members] add:
void open(const filesystem::path& p, ios_base::openmode mode = ios_base::in|ios_base::out);
Effects: calls
open(p.c_str(), mode)
.