Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 20 additions & 35 deletions stl/inc/fstream
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ namespace experimental {
} // namespace experimental
#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM

// clang-format off
template <class _Ty>
_INLINE_VAR constexpr bool _Is_any_path = _Is_any_of_v<_Ty
#if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM
, experimental::filesystem::path
#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM
#if _HAS_CXX17
, filesystem::path
#endif // _HAS_CXX17
>;
// clang-format on

extern _CRTIMP2_PURE FILE* __CLRCALL_PURE_OR_CDECL _Fiopen(const char*, ios_base::openmode, int);
extern _CRTIMP2_PURE FILE* __CLRCALL_PURE_OR_CDECL _Fiopen(const wchar_t*, ios_base::openmode, int);

Expand Down Expand Up @@ -830,19 +842,10 @@ public:
const wstring& _Str, ios_base::openmode _Mode = ios_base::in, int _Prot = ios_base::_Default_open_prot)
: basic_ifstream(_Str.c_str(), _Mode, _Prot) {} // extension

#if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM
template <class _Path_ish = experimental::filesystem::path>
explicit basic_ifstream(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::in,
int _Prot = ios_base::_Default_open_prot)
: basic_ifstream(_Path.c_str(), _Mode, _Prot) {} // _Prot is an extension
#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM

#if _HAS_CXX17
template <int = 0, class _Path_ish = filesystem::path>
explicit basic_ifstream(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::in,
int _Prot = ios_base::_Default_open_prot)
template <class _Ty, enable_if_t<_Is_any_path<_Ty>, int> = 0>
explicit basic_ifstream(
const _Ty& _Path, ios_base::openmode _Mode = ios_base::in, int _Prot = ios_base::_Default_open_prot)
: basic_ifstream(_Path.c_str(), _Mode, _Prot) {} // _Prot is an extension
#endif // _HAS_CXX17

#ifdef _NATIVE_WCHAR_T_DEFINED
explicit basic_ifstream(const unsigned short* _Filename, ios_base::openmode _Mode = ios_base::in,
Expand Down Expand Up @@ -1023,19 +1026,10 @@ public:
const wstring& _Str, ios_base::openmode _Mode = ios_base::out, int _Prot = ios_base::_Default_open_prot)
: basic_ofstream(_Str.c_str(), _Mode, _Prot) {} // extension

#if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM
template <class _Path_ish = experimental::filesystem::path>
explicit basic_ofstream(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::out,
int _Prot = ios_base::_Default_open_prot)
: basic_ofstream(_Path.c_str(), _Mode, _Prot) {} // _Prot is an extension
#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM

#if _HAS_CXX17
template <int = 0, class _Path_ish = filesystem::path>
explicit basic_ofstream(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::out,
int _Prot = ios_base::_Default_open_prot)
template <class _Ty, enable_if_t<_Is_any_path<_Ty>, int> = 0>
explicit basic_ofstream(
const _Ty& _Path, ios_base::openmode _Mode = ios_base::out, int _Prot = ios_base::_Default_open_prot)
: basic_ofstream(_Path.c_str(), _Mode, _Prot) {} // _Prot is an extension
#endif // _HAS_CXX17

#ifdef _NATIVE_WCHAR_T_DEFINED
explicit basic_ofstream(const unsigned short* _Filename, ios_base::openmode _Mode = ios_base::out,
Expand Down Expand Up @@ -1221,19 +1215,10 @@ public:
int _Prot = ios_base::_Default_open_prot)
: basic_fstream(_Str.c_str(), _Mode, _Prot) {} // extension

#if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM
template <class _Path_ish = experimental::filesystem::path>
explicit basic_fstream(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::in | ios_base::out,
template <class _Ty, enable_if_t<_Is_any_path<_Ty>, int> = 0>
explicit basic_fstream(const _Ty& _Path, ios_base::openmode _Mode = ios_base::in | ios_base::out,
int _Prot = ios_base::_Default_open_prot)
: basic_fstream(_Path.c_str(), _Mode, _Prot) {} // _Prot is an extension
#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM

#if _HAS_CXX17
template <int = 0, class _Path_ish = filesystem::path>
explicit basic_fstream(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::in | ios_base::out,
int _Prot = ios_base::_Default_open_prot)
: basic_fstream(_Path.c_str(), _Mode, _Prot) {} // _Prot is an extension
#endif // _HAS_CXX17

#ifdef _NATIVE_WCHAR_T_DEFINED
explicit basic_fstream(const unsigned short* _Filename, ios_base::openmode _Mode = ios_base::in | ios_base::out,
Expand Down