@@ -54,10 +54,12 @@ public:
5454 const wstring& _Str, ios_base::openmode _Mode = ios_base::in, int _Prot = ios_base::_Default_open_prot)
5555 : basic_ifstream(_Str.c_str(), _Mode, _Prot) {} // extension
5656
57- template <class _Ty, enable_if_t<_Is_any_path<_Ty>, int> = 0>
57+ #if _HAS_CXX17
58+ template <class _Ty, enable_if_t<is_same_v<_Ty, filesystem::path>, int> = 0>
5859 explicit basic_ifstream(
5960 const _Ty& _Path, ios_base::openmode _Mode = ios_base::in, int _Prot = ios_base::_Default_open_prot)
6061 : basic_ifstream(_Path.c_str(), _Mode, _Prot) {} // _Prot is an extension
62+ #endif // _HAS_CXX17
6163
6264 explicit basic_ifstream(FILE* _File) : _Mybase(_STD addressof(_Filebuffer)), _Filebuffer(_File) {} // extension
6365
@@ -102,15 +104,6 @@ public:
102104 open(_Str.c_str(), _Mode, _Prot);
103105 }
104106
105- #if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM
106- template <class _Path_ish = experimental::filesystem::path>
107- void open(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::in,
108- int _Prot = ios_base::_Default_open_prot) {
109- // _Prot is an extension
110- open(_Path.c_str(), _Mode, _Prot);
111- }
112- #endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM
113-
114107#if _HAS_CXX17
115108 template <int = 0, class _Path_ish = filesystem::path>
116109 void open(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::in,
@@ -207,10 +200,12 @@ public:
207200 const wstring& _Str, ios_base::openmode _Mode = ios_base::out, int _Prot = ios_base::_Default_open_prot)
208201 : basic_ofstream(_Str.c_str(), _Mode, _Prot) {} // extension
209202
210- template <class _Ty, enable_if_t<_Is_any_path<_Ty>, int> = 0>
203+ #if _HAS_CXX17
204+ template <class _Ty, enable_if_t<is_same_v<_Ty, filesystem::path>, int> = 0>
211205 explicit basic_ofstream(
212206 const _Ty& _Path, ios_base::openmode _Mode = ios_base::out, int _Prot = ios_base::_Default_open_prot)
213207 : basic_ofstream(_Path.c_str(), _Mode, _Prot) {} // _Prot is an extension
208+ #endif // _HAS_CXX17
214209
215210 explicit basic_ofstream(FILE* _File) : _Mybase(_STD addressof(_Filebuffer)), _Filebuffer(_File) {} // extension
216211
@@ -255,15 +250,6 @@ public:
255250 open(_Str.c_str(), _Mode, _Prot);
256251 }
257252
258- #if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM
259- template <class _Path_ish = experimental::filesystem::path>
260- void open(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::out,
261- int _Prot = ios_base::_Default_open_prot) {
262- // _Prot is an extension
263- open(_Path.c_str(), _Mode, _Prot);
264- }
265- #endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM
266-
267253#if _HAS_CXX17
268254 template <int = 0, class _Path_ish = filesystem::path>
269255 void open(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::out,
@@ -365,10 +351,12 @@ public:
365351 int _Prot = ios_base::_Default_open_prot)
366352 : basic_fstream(_Str.c_str(), _Mode, _Prot) {} // extension
367353
368- template <class _Ty, enable_if_t<_Is_any_path<_Ty>, int> = 0>
354+ #if _HAS_CXX17
355+ template <class _Ty, enable_if_t<is_same_v<_Ty, filesystem::path>, int> = 0>
369356 explicit basic_fstream(const _Ty& _Path, ios_base::openmode _Mode = ios_base::in | ios_base::out,
370357 int _Prot = ios_base::_Default_open_prot)
371358 : basic_fstream(_Path.c_str(), _Mode, _Prot) {} // _Prot is an extension
359+ #endif // _HAS_CXX17
372360
373361 explicit basic_fstream(FILE* _File) : _Mybase(_STD addressof(_Filebuffer)), _Filebuffer(_File) {} // extension
374362
@@ -414,15 +402,6 @@ public:
414402 open(_Str.c_str(), _Mode, _Prot);
415403 }
416404
417- #if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM
418- template <class _Path_ish = experimental::filesystem::path>
419- void open(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::in | ios_base::out,
420- int _Prot = ios_base::_Default_open_prot) {
421- // extension
422- open(_Path.c_str(), _Mode, _Prot);
423- }
424- #endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM
425-
426405#if _HAS_CXX17
427406 template <int = 0, class _Path_ish = filesystem::path>
428407 void open(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::in | ios_base::out,
@@ -487,8 +466,6 @@ void swap(basic_fstream<_Elem, _Traits>& _Left, basic_fstream<_Elem, _Traits>& _
487466}
488467_STD_END
489468
490- #undef _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM
491-
492469#pragma pop_macro("new")
493470_STL_RESTORE_CLANG_WARNINGS
494471#pragma warning(pop)
0 commit comments