1313#include < __algorithm/unwrap_iter.h>
1414#include < __config>
1515#include < __filesystem/path.h>
16+
17+ #if _LIBCPP_HAS_LOCALIZATION
1618#include < __locale>
19+ #endif
1720#include < string>
1821
1922#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2427
2528_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
2629
30+ # if !defined(_LIBCPP_WIN32API) || _LIBCPP_HAS_LOCALIZATION
2731template <class _InputIt , __enable_if_t <__is_pathable<_InputIt>::value, int > = 0 >
2832_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path (_InputIt __f, _InputIt __l) {
2933 static_assert (
30- # if _LIBCPP_HAS_CHAR8_T
31- is_same<typename __is_pathable<_InputIt>::__char_type, char8_t >::value ||
32- # endif
33- is_same<typename __is_pathable<_InputIt>::__char_type, char >::value,
34- " u8path(Iter, Iter) requires Iter have a value_type of type 'char'"
35- " or 'char8_t'" );
36- # if defined(_LIBCPP_WIN32API)
37- string __tmp (__f, __l);
38- using _CVT = __widen_from_utf8<sizeof (wchar_t ) * __CHAR_BIT__>;
39- std::wstring __w;
40- __w.reserve (__tmp.size ());
41- _CVT ()(back_inserter (__w), __tmp.data (), __tmp.data () + __tmp.size ());
42- return path (__w);
43- # else
44- return path (__f, __l);
45- # endif /* !_LIBCPP_WIN32API */
34+ # if _LIBCPP_HAS_CHAR8_T
35+ is_same<typename __is_pathable<_InputIt>::__char_type, char8_t >::value ||
36+ # endif
37+ is_same<typename __is_pathable<_InputIt>::__char_type, char >::value,
38+ " u8path(Iter, Iter) requires Iter have a value_type of type 'char'"
39+ " or 'char8_t'" );
40+ # if defined(_LIBCPP_WIN32API)
41+ string __tmp (__f, __l);
42+ using _CVT = __widen_from_utf8<sizeof (wchar_t ) * __CHAR_BIT__>;
43+ std::wstring __w;
44+ __w.reserve (__tmp.size ());
45+ _CVT ()(back_inserter (__w), __tmp.data (), __tmp.data () + __tmp.size ());
46+ return path (__w);
47+ # else
48+ return path (__f, __l);
49+ # endif /* !_LIBCPP_WIN32API */
4650}
51+ # endif /* !_LIBCPP_WIN32API || _LIBCPP_HAS_LOCALIZATION */
4752
48- # if defined(_LIBCPP_WIN32API)
53+ # if defined(_LIBCPP_WIN32API) && _LIBCPP_HAS_LOCALIZATION
4954template <class _InputIt , __enable_if_t <__is_pathable<_InputIt>::value, int > = 0 >
5055_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path (_InputIt __f, _NullSentinel) {
5156 static_assert (
@@ -65,7 +70,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f,
6570 _CVT ()(back_inserter (__w), __tmp.data (), __tmp.data () + __tmp.size ());
6671 return path (__w);
6772}
68- # endif /* _LIBCPP_WIN32API */
73+ # endif /* _LIBCPP_WIN32API && _LIBCPP_HAS_LOCALIZATION */
6974
7075template <class _Source , __enable_if_t <__is_pathable<_Source>::value, int > = 0 >
7176_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path (const _Source& __s) {
@@ -85,7 +90,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(const _Source&
8590}
8691
8792_LIBCPP_END_NAMESPACE_FILESYSTEM
88-
8993#endif // _LIBCPP_STD_VER >= 17
9094
9195#endif // _LIBCPP___FILESYSTEM_U8PATH_H
0 commit comments