30 #ifndef _GLIBCXX_EXPERIMENTAL_FS_PATH_H
31 #define _GLIBCXX_EXPERIMENTAL_FS_PATH_H 1
33 #if __cplusplus < 201103L
47 #if __cplusplus == 201402L
51 #if defined(_WIN32) && !defined(__CYGWIN__)
52 # define _GLIBCXX_FILESYSTEM_IS_WINDOWS 1
56 namespace std _GLIBCXX_VISIBILITY(default)
58 _GLIBCXX_BEGIN_NAMESPACE_VERSION
60 namespace experimental
66 _GLIBCXX_BEGIN_NAMESPACE_CXX11
68 #if __cplusplus == 201402L
69 using std::experimental::basic_string_view;
70 #elif __cplusplus > 201402L
71 using std::basic_string_view;
82 template<
typename _CharT,
83 typename _Ch =
typename remove_const<_CharT>::type>
84 using __is_encoded_char
85 = __or_<is_same<_Ch, char>,
87 #ifdef _GLIBCXX_USE_CHAR8_T
93 template<
typename _Iter,
94 typename _Iter_traits = std::iterator_traits<_Iter>>
95 using __is_path_iter_src
96 = __and_<__is_encoded_char<typename _Iter_traits::value_type>,
98 typename _Iter_traits::iterator_category>>;
100 template<
typename _Iter>
101 static __is_path_iter_src<_Iter>
102 __is_path_src(_Iter,
int);
104 template<
typename _CharT,
typename _Traits,
typename _Alloc>
105 static __is_encoded_char<_CharT>
108 #if __cplusplus >= 201402L
109 template<
typename _CharT,
typename _Traits>
110 static __is_encoded_char<_CharT>
111 __is_path_src(
const basic_string_view<_CharT, _Traits>&,
int);
114 template<
typename _Unknown>
116 __is_path_src(
const _Unknown&, ...);
118 template<
typename _Tp1,
typename _Tp2>
119 struct __constructible_from;
121 template<
typename _Iter>
122 struct __constructible_from<_Iter, _Iter>
123 : __is_path_iter_src<_Iter>
126 template<
typename _Source>
127 struct __constructible_from<_Source, void>
128 : decltype(__is_path_src(std::declval<_Source>(), 0))
131 template<
typename _Tp1,
typename _Tp2 = void,
132 typename _Tp1_nocv =
typename remove_cv<_Tp1>::type,
133 typename _Tp1_noptr =
typename remove_pointer<_Tp1>::type>
134 using _Path =
typename
136 __not_<is_void<_Tp1_noptr>>,
137 __constructible_from<_Tp1, _Tp2>>::value,
140 template<
typename _Source>
142 _S_range_begin(_Source __begin) {
return __begin; }
144 struct __null_terminated { };
146 template<
typename _Source>
147 static __null_terminated
148 _S_range_end(_Source) {
return {}; }
150 template<
typename _CharT,
typename _Traits,
typename _Alloc>
153 {
return __str.
data(); }
155 template<
typename _CharT,
typename _Traits,
typename _Alloc>
158 {
return __str.
data() + __str.
size(); }
160 #if __cplusplus >= 201402L
161 template<
typename _CharT,
typename _Traits>
163 _S_range_begin(
const basic_string_view<_CharT, _Traits>& __str)
164 {
return __str.data(); }
166 template<
typename _CharT,
typename _Traits>
168 _S_range_end(
const basic_string_view<_CharT, _Traits>& __str)
169 {
return __str.data() + __str.size(); }
172 template<
typename _Tp,
173 typename _Iter = decltype(_S_range_begin(std::declval<_Tp>())),
174 typename _Val =
typename std::iterator_traits<_Iter>::value_type>
180 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
181 typedef wchar_t value_type;
182 static constexpr value_type preferred_separator = L
'\\';
184 typedef char value_type;
185 static constexpr value_type preferred_separator =
'/';
196 : _M_pathname(std::move(__p._M_pathname)), _M_type(__p._M_type)
198 if (_M_type == _Type::_Multi)
204 : _M_pathname(std::move(__source))
205 { _M_split_cmpts(); }
207 template<
typename _Source,
208 typename _Require = _Path<_Source>>
209 path(_Source
const& __source)
210 : _M_pathname(_S_convert(_S_range_begin(__source),
211 _S_range_end(__source)))
212 { _M_split_cmpts(); }
214 template<
typename _InputIterator,
215 typename _Require = _Path<_InputIterator, _InputIterator>>
216 path(_InputIterator __first, _InputIterator __last)
217 : _M_pathname(_S_convert(__first, __last))
218 { _M_split_cmpts(); }
220 template<
typename _Source,
221 typename _Require = _Path<_Source>,
222 typename _Require2 = __value_type_is_char<_Source>>
223 path(_Source
const& __source,
const locale& __loc)
224 : _M_pathname(_S_convert_loc(_S_range_begin(__source),
225 _S_range_end(__source), __loc))
226 { _M_split_cmpts(); }
228 template<
typename _InputIterator,
229 typename _Require = _Path<_InputIterator, _InputIterator>,
230 typename _Require2 = __value_type_is_char<_InputIterator>>
231 path(_InputIterator __first, _InputIterator __last,
const locale& __loc)
232 : _M_pathname(_S_convert_loc(__first, __last, __loc))
233 { _M_split_cmpts(); }
239 path& operator=(
const path& __p) =
default;
240 path& operator=(path&& __p)
noexcept;
244 template<
typename _Source>
246 operator=(_Source
const& __source)
247 {
return *
this = path(__source); }
249 template<
typename _Source>
251 assign(_Source
const& __source)
252 {
return *
this = path(__source); }
254 template<
typename _InputIterator>
255 _Path<_InputIterator, _InputIterator>&
256 assign(_InputIterator __first, _InputIterator __last)
257 {
return *
this = path(__first, __last); }
261 path& operator/=(
const path& __p) {
return _M_append(__p._M_pathname); }
263 template <
class _Source>
265 operator/=(_Source
const& __source)
266 {
return append(__source); }
268 template<
typename _Source>
270 append(_Source
const& __source)
272 return _M_append(_S_convert(_S_range_begin(__source),
273 _S_range_end(__source)));
276 template<
typename _InputIterator>
277 _Path<_InputIterator, _InputIterator>&
278 append(_InputIterator __first, _InputIterator __last)
279 {
return _M_append(_S_convert(__first, __last)); }
283 path& operator+=(
const path& __x);
285 path& operator+=(
const value_type* __x);
286 path& operator+=(value_type __x);
287 #if __cplusplus >= 201402L
288 path& operator+=(basic_string_view<value_type> __x);
291 template<
typename _Source>
293 operator+=(_Source
const& __x) {
return concat(__x); }
295 template<
typename _CharT>
296 _Path<_CharT*, _CharT*>&
297 operator+=(_CharT __x);
299 template<
typename _Source>
301 concat(_Source
const& __x)
302 {
return *
this += _S_convert(_S_range_begin(__x), _S_range_end(__x)); }
304 template<
typename _InputIterator>
305 _Path<_InputIterator, _InputIterator>&
306 concat(_InputIterator __first, _InputIterator __last)
307 {
return *
this += _S_convert(__first, __last); }
311 void clear()
noexcept { _M_pathname.
clear(); _M_split_cmpts(); }
313 path& make_preferred();
314 path& remove_filename();
315 path& replace_filename(
const path& __replacement);
316 path& replace_extension(
const path& __replacement = path());
323 const value_type* c_str()
const noexcept {
return _M_pathname.
c_str(); }
324 operator string_type()
const {
return _M_pathname; }
326 template<
typename _CharT,
typename _Traits = std::
char_traits<_CharT>,
327 typename _Allocator = std::allocator<_CharT>>
329 string(
const _Allocator& __a = _Allocator())
const;
332 #if _GLIBCXX_USE_WCHAR_T
335 #ifdef _GLIBCXX_USE_CHAR8_T
336 __attribute__((__abi_tag__(
"__u8")))
337 std::u8string u8string()
const;
340 #endif // _GLIBCXX_USE_CHAR8_T
345 template<
typename _CharT,
typename _Traits = std::
char_traits<_CharT>,
346 typename _Allocator = std::allocator<_CharT>>
348 generic_string(
const _Allocator& __a = _Allocator())
const;
351 #if _GLIBCXX_USE_WCHAR_T
354 #ifdef _GLIBCXX_USE_CHAR8_T
355 __attribute__((__abi_tag__(
"__u8")))
356 std::u8string generic_u8string()
const;
359 #endif // _GLIBCXX_USE_CHAR8_T
365 int compare(
const path& __p)
const noexcept;
367 int compare(
const value_type* __s)
const;
368 #if __cplusplus >= 201402L
369 int compare(
const basic_string_view<value_type> __s)
const;
374 path root_name()
const;
375 path root_directory()
const;
376 path root_path()
const;
377 path relative_path()
const;
378 path parent_path()
const;
379 path filename()
const;
381 path extension()
const;
385 _GLIBCXX_NODISCARD
bool empty()
const noexcept {
return _M_pathname.
empty(); }
386 bool has_root_name()
const;
387 bool has_root_directory()
const;
388 bool has_root_path()
const;
389 bool has_relative_path()
const;
390 bool has_parent_path()
const;
391 bool has_filename()
const;
392 bool has_stem()
const;
393 bool has_extension()
const;
394 bool is_absolute()
const;
395 bool is_relative()
const {
return !is_absolute(); }
405 template<
typename _InputIterator,
406 typename _Traits = std::iterator_traits<_InputIterator>,
408 =
typename std::remove_cv<typename _Traits::value_type>::type>
410 _S_string_from_iter(_InputIterator __source)
413 for (_CharT __ch = *__source; __ch != _CharT(); __ch = *++__source)
419 enum class _Type : unsigned char {
420 _Multi, _Root_name, _Root_dir, _Filename
423 path(
string_type __str, _Type __type) : _M_pathname(__str), _M_type(__type)
425 __glibcxx_assert(!empty());
426 __glibcxx_assert(_M_type != _Type::_Multi);
429 enum class _Split { _Stem, _Extension };
433 if (!_M_pathname.
empty() && !_S_is_dir_sep(_M_pathname.
back())
434 && !__str.
empty() && !_S_is_dir_sep(__str.
front()))
435 _M_pathname += preferred_separator;
436 _M_pathname += __str;
443 template<
typename _CharT>
447 _S_convert(value_type* __src, __null_terminated)
451 _S_convert(
const value_type* __src, __null_terminated)
454 template<
typename _Iter>
456 _S_convert(_Iter __first, _Iter __last)
458 using __value_type =
typename std::iterator_traits<_Iter>::value_type;
459 return _Cvt<typename remove_cv<__value_type>::type>::
460 _S_convert(__first, __last);
463 template<
typename _InputIterator>
465 _S_convert(_InputIterator __src, __null_terminated)
467 auto __s = _S_string_from_iter(__src);
468 return _S_convert(__s.c_str(), __s.c_str() + __s.size());
472 _S_convert_loc(
const char* __first,
const char* __last,
475 template<
typename _Iter>
477 _S_convert_loc(_Iter __first, _Iter __last,
const std::locale& __loc)
480 return _S_convert_loc(__str.data(), __str.data()+__str.size(), __loc);
483 template<
typename _InputIterator>
485 _S_convert_loc(_InputIterator __src, __null_terminated,
489 return _S_convert_loc(__s.data(), __s.data() + __s.size(), __loc);
492 static bool _S_is_dir_sep(value_type __ch)
494 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
495 return __ch == L
'/' || __ch == preferred_separator;
501 void _M_split_cmpts();
503 void _M_add_root_name(
size_t __n);
504 void _M_add_root_dir(
size_t __pos);
505 void _M_add_filename(
size_t __pos,
size_t __n);
510 using _List = _GLIBCXX_STD_C::vector<_Cmpt>;
512 _Type _M_type = _Type::_Multi;
517 size_t hash_value(
const path& __p)
noexcept;
520 inline bool operator<(
const path& __lhs,
const path& __rhs)
noexcept
521 {
return __lhs.compare(__rhs) < 0; }
524 inline bool operator<=(
const path& __lhs,
const path& __rhs)
noexcept
525 {
return !(__rhs < __lhs); }
528 inline bool operator>(
const path& __lhs,
const path& __rhs)
noexcept
529 {
return __rhs < __lhs; }
532 inline bool operator>=(
const path& __lhs,
const path& __rhs)
noexcept
533 {
return !(__lhs < __rhs); }
536 inline bool operator==(
const path& __lhs,
const path& __rhs)
noexcept
537 {
return __lhs.compare(__rhs) == 0; }
540 inline bool operator!=(
const path& __lhs,
const path& __rhs)
noexcept
541 {
return !(__lhs == __rhs); }
544 inline path
operator/(
const path& __lhs,
const path& __rhs)
546 path __result(__lhs);
552 template<
typename _CharT,
typename _Traits>
553 basic_ostream<_CharT, _Traits>&
554 operator<<(basic_ostream<_CharT, _Traits>& __os,
const path& __p)
556 auto __tmp = __p.string<_CharT, _Traits>();
557 using __quoted_string
559 __os << __quoted_string{__tmp, _CharT(
'"'), _CharT(
'\\')};
564 template<
typename _CharT,
typename _Traits>
565 basic_istream<_CharT, _Traits>&
566 operator>>(basic_istream<_CharT, _Traits>& __is, path& __p)
568 basic_string<_CharT, _Traits> __tmp;
569 using __quoted_string
571 if (__is >> __quoted_string{ __tmp, _CharT(
'"'), _CharT(
'\\') })
572 __p = std::move(__tmp);
577 template<
typename _Source>
579 u8path(
const _Source& __source)
581 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
582 return path{ path::string_type{__source} };
584 return path{ __source };
589 template<
typename _InputIterator>
591 u8path(_InputIterator __first, _InputIterator __last)
593 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
594 return path{ path::string_type{__first, __last} };
596 return path{ __first, __last };
603 filesystem_error(
const string& __what_arg, error_code __ec)
604 : system_error(__ec, __what_arg) { }
606 filesystem_error(
const string& __what_arg,
const path& __p1,
608 : system_error(__ec, __what_arg), _M_path1(__p1) { }
610 filesystem_error(
const string& __what_arg,
const path& __p1,
611 const path& __p2, error_code __ec)
612 : system_error(__ec, __what_arg), _M_path1(__p1), _M_path2(__p2)
617 const path& path1() const
noexcept {
return _M_path1; }
618 const path& path2() const
noexcept {
return _M_path2; }
619 const char* what() const
noexcept {
return _M_what.c_str(); }
629 struct path::_Cmpt : path
631 _Cmpt(string_type __s, _Type __t,
size_t __pos)
632 : path(std::move(__s), __t), _M_pos(__pos) { }
634 _Cmpt() : _M_pos(-1) { }
641 struct path::_Cvt<path::value_type>
643 template<
typename _Iter>
645 _S_convert(_Iter __first, _Iter __last)
646 {
return string_type{__first, __last}; }
649 template<
typename _CharT>
652 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
654 _S_wconvert(
const char* __f,
const char* __l,
true_type)
657 const auto& __cvt = std::use_facet<_Cvt>(
std::locale{});
659 if (__str_codecvt_in(__f, __l, __wstr, __cvt))
661 _GLIBCXX_THROW_OR_ABORT(filesystem_error(
662 "Cannot convert character sequence",
663 std::make_error_code(errc::illegal_byte_sequence)));
667 _S_wconvert(
const _CharT* __f,
const _CharT* __l,
false_type)
669 std::codecvt_utf8<_CharT> __cvt;
671 if (__str_codecvt_out(__f, __l, __str, __cvt))
673 const char* __f2 = __str.
data();
674 const char* __l2 = __f2 + __str.size();
675 std::codecvt_utf8<wchar_t> __wcvt;
677 if (__str_codecvt_in(__f2, __l2, __wstr, __wcvt))
680 _GLIBCXX_THROW_OR_ABORT(filesystem_error(
681 "Cannot convert character sequence",
682 std::make_error_code(errc::illegal_byte_sequence)));
686 _S_convert(
const _CharT* __f,
const _CharT* __l)
688 return _S_wconvert(__f, __l, is_same<_CharT, char>{});
692 _S_convert(
const _CharT* __f,
const _CharT* __l)
694 #ifdef _GLIBCXX_USE_CHAR8_T
695 if constexpr (is_same<_CharT, char8_t>::value)
697 string_type __str(__f, __l);
703 std::codecvt_utf8<_CharT> __cvt;
705 if (__str_codecvt_out(__f, __l, __str, __cvt))
707 #ifdef _GLIBCXX_USE_CHAR8_T
710 _GLIBCXX_THROW_OR_ABORT(filesystem_error(
711 "Cannot convert character sequence",
712 std::make_error_code(errc::illegal_byte_sequence)));
717 _S_convert(_CharT* __f, _CharT* __l)
719 return _S_convert(const_cast<const _CharT*>(__f),
720 const_cast<const _CharT*>(__l));
723 template<
typename _Iter>
725 _S_convert(_Iter __first, _Iter __last)
728 return _S_convert(__str.data(), __str.data() + __str.size());
731 template<
typename _Iter,
typename _Cont>
733 _S_convert(__gnu_cxx::__normal_iterator<_Iter, _Cont> __first,
734 __gnu_cxx::__normal_iterator<_Iter, _Cont> __last)
735 {
return _S_convert(__first.base(), __last.base()); }
742 using difference_type = std::ptrdiff_t;
748 iterator() : _M_path(
nullptr), _M_cur(), _M_at_end() { }
757 iterator operator++(
int) {
auto __tmp = *
this; ++*
this;
return __tmp; }
760 iterator operator--(
int) {
auto __tmp = *
this; --*
this;
return __tmp; }
763 {
return __lhs._M_equals(__rhs); }
766 {
return !__lhs._M_equals(__rhs); }
771 iterator(
const path* __path, path::_List::const_iterator __iter)
772 : _M_path(__path), _M_cur(__iter), _M_at_end()
776 : _M_path(__path), _M_cur(), _M_at_end(__at_end)
782 path::_List::const_iterator _M_cur;
790 _M_pathname = std::move(__p._M_pathname);
791 _M_cmpts = std::move(__p._M_cmpts);
792 _M_type = __p._M_type;
798 path::operator=(string_type&& __source)
799 {
return *
this =
path(std::move(__source)); }
802 path::assign(string_type&& __source)
803 {
return *
this = path(std::move(__source)); }
806 path::operator+=(
const path& __p)
808 return operator+=(__p.native());
812 path::operator+=(
const string_type& __x)
820 path::operator+=(
const value_type* __x)
828 path::operator+=(value_type __x)
835 #if __cplusplus >= 201402L
837 path::operator+=(basic_string_view<value_type> __x)
839 _M_pathname.
append(__x.data(), __x.size());
845 template<
typename _CharT>
846 inline path::_Path<_CharT*, _CharT*>&
847 path::operator+=(_CharT __x)
850 return concat(__addr, __addr + 1);
854 path::make_preferred()
856 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
858 preferred_separator);
863 inline void path::swap(path& __rhs) noexcept
865 _M_pathname.swap(__rhs._M_pathname);
866 _M_cmpts.swap(__rhs._M_cmpts);
867 std::swap(_M_type, __rhs._M_type);
870 template<
typename _CharT,
typename _Traits,
typename _Allocator>
874 if (is_same<_CharT, value_type>::value)
875 return { _M_pathname.
begin(), _M_pathname.
end(), __a };
877 const value_type* __first = _M_pathname.
data();
878 const value_type* __last = __first + _M_pathname.
size();
880 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
881 using _CharAlloc = __alloc_rebind<_Allocator, char>;
882 using _String = basic_string<char, char_traits<char>, _CharAlloc>;
883 using _WString = basic_string<_CharT, _Traits, _Allocator>;
886 codecvt_utf8<value_type> __cvt;
887 _String __u8str{_CharAlloc{__a}};
888 if (__str_codecvt_out(__first, __last, __u8str, __cvt))
893 operator()(
const _String& __from, _String&,
true_type)
897 operator()(
const _String& __from, _WString& __to,
false_type)
899 #ifdef _GLIBCXX_USE_CHAR8_T
900 if constexpr (is_same<_CharT, char8_t>::value)
902 __to.assign(__from.begin(), __from.end());
909 codecvt_utf8<_CharT> __cvt;
910 const char* __f = __from.data();
911 const char* __l = __f + __from.size();
912 if (__str_codecvt_in(__f, __l, __to, __cvt))
914 #ifdef _GLIBCXX_USE_CHAR8_T
921 if (
auto* __p = __dispatch(__u8str, __wstr, is_same<_CharT, char>{}))
925 #ifdef _GLIBCXX_USE_CHAR8_T
926 if constexpr (is_same<_CharT, char8_t>::value)
928 basic_string<_CharT, _Traits, _Allocator> __wstr{__first, __last, __a};
934 codecvt_utf8<_CharT> __cvt;
935 basic_string<_CharT, _Traits, _Allocator> __wstr{__a};
936 if (__str_codecvt_in(__first, __last, __wstr, __cvt))
938 #ifdef _GLIBCXX_USE_CHAR8_T
942 _GLIBCXX_THROW_OR_ABORT(filesystem_error(
943 "Cannot convert character sequence",
944 std::make_error_code(errc::illegal_byte_sequence)));
950 #if _GLIBCXX_USE_WCHAR_T
955 #ifdef _GLIBCXX_USE_CHAR8_T
957 path::u8string()
const {
return string<char8_t>(); }
960 path::u8string()
const
962 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
965 codecvt_utf8<value_type> __cvt;
966 const value_type* __first = _M_pathname.
data();
967 const value_type* __last = __first + _M_pathname.
size();
968 if (__str_codecvt_out(__first, __last, __str, __cvt))
970 _GLIBCXX_THROW_OR_ABORT(filesystem_error(
971 "Cannot convert character sequence",
972 std::make_error_code(errc::illegal_byte_sequence)));
977 #endif // _GLIBCXX_USE_CHAR8_T
985 #ifndef _GLIBCXX_FILESYSTEM_IS_WINDOWS
986 template<
typename _CharT,
typename _Traits,
typename _Allocator>
988 path::generic_string(
const _Allocator& __a)
const
989 {
return string<_CharT, _Traits, _Allocator>(__a); }
992 path::generic_string()
const {
return string(); }
994 #if _GLIBCXX_USE_WCHAR_T
996 path::generic_wstring()
const {
return wstring(); }
999 #ifdef _GLIBCXX_USE_CHAR8_T
1000 inline std::u8string
1001 path::generic_u8string()
const {
return u8string(); }
1004 path::generic_u8string()
const {
return u8string(); }
1008 path::generic_u16string()
const {
return u16string(); }
1011 path::generic_u32string()
const {
return u32string(); }
1015 path::compare(
const string_type& __s)
const {
return compare(path(__s)); }
1018 path::compare(
const value_type* __s)
const {
return compare(path(__s)); }
1020 #if __cplusplus >= 201402L
1022 path::compare(basic_string_view<value_type> __s)
const
1023 {
return compare(path(__s)); }
1027 path::filename()
const {
return empty() ? path() : *--
end(); }
1032 auto ext = _M_find_extension();
1033 if (ext.first && ext.second != 0)
1034 return path{ext.first->substr(0, ext.second)};
1039 path::extension()
const
1041 auto ext = _M_find_extension();
1043 return path{ext.first->substr(ext.second)};
1048 path::has_stem()
const
1050 auto ext = _M_find_extension();
1051 return ext.first && ext.second != 0;
1055 path::has_extension()
const
1057 auto ext = _M_find_extension();
1062 path::is_absolute()
const
1064 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
1065 return has_root_name() && has_root_directory();
1067 return has_root_directory();
1071 inline path::iterator
1074 if (_M_type == _Type::_Multi)
1075 return iterator(
this, _M_cmpts.
begin());
1076 return iterator(
this,
false);
1079 inline path::iterator
1082 if (_M_type == _Type::_Multi)
1083 return iterator(
this, _M_cmpts.
end());
1084 return iterator(
this,
true);
1087 inline path::iterator&
1088 path::iterator::operator++()
1090 __glibcxx_assert(_M_path !=
nullptr);
1091 if (_M_path->_M_type == _Type::_Multi)
1093 __glibcxx_assert(_M_cur != _M_path->_M_cmpts.
end());
1098 __glibcxx_assert(!_M_at_end);
1104 inline path::iterator&
1105 path::iterator::operator--()
1107 __glibcxx_assert(_M_path !=
nullptr);
1108 if (_M_path->_M_type == _Type::_Multi)
1110 __glibcxx_assert(_M_cur != _M_path->_M_cmpts.begin());
1115 __glibcxx_assert(_M_at_end);
1121 inline path::iterator::reference
1122 path::iterator::operator*()
const
1124 __glibcxx_assert(_M_path !=
nullptr);
1125 if (_M_path->_M_type == _Type::_Multi)
1127 __glibcxx_assert(_M_cur != _M_path->_M_cmpts.end());
1134 path::iterator::_M_equals(iterator __rhs)
const
1136 if (_M_path != __rhs._M_path)
1138 if (_M_path ==
nullptr)
1140 if (_M_path->_M_type == path::_Type::_Multi)
1141 return _M_cur == __rhs._M_cur;
1142 return _M_at_end == __rhs._M_at_end;
1146 _GLIBCXX_END_NAMESPACE_CXX11
1151 _GLIBCXX_END_NAMESPACE_VERSION
1156 #endif // _GLIBCXX_EXPERIMENTAL_FS_PATH_H
basic_string< char32_t > u32string
A string of char32_t.
Class codecvt<wchar_t, char, mbstate_t> specialization.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list. ...
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
_GLIBCXX_NODISCARD bool empty() const noexcept
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
Global I/O operators for bitsets.
basic_string & append(const basic_string &__str)
Append a string to this string.
Bidirectional iterators support a superset of forward iterator operations.
static const size_type npos
Value returned by various member functions when they fail.
basic_string< wchar_t > wstring
A string of wchar_t.
const _CharT * data() const noexcept
Return const pointer to contents.
Struct holding two objects of arbitrary type.
enable_if< ::__array_traits< _Tp, _Nm >::_Is_swappable::value >::type noexcept(noexcept(__one.swap(__two)))
swap
void replace(_ForwardIterator __first, _ForwardIterator __last, const _Tp &__old_value, const _Tp &__new_value)
Replace each occurrence of one value in a sequence with another value.
Define a member typedef type only if a boolean constant is true.
_GLIBCXX_END_NAMESPACE_CXX11 typedef basic_string< char > string
A string of char.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
Thrown to indicate error code of underlying system.
An iterator for the components of a path.
iterator begin() noexcept
basic_string< char16_t > u16string
A string of char16_t.
Managing sequences of characters and character-like objects.
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initializer_list.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
_GLIBCXX20_CONSTEXPR complex< _Tp > operator/(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x divided by y.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
Struct for delimited strings.
void push_back(_CharT __c)
Append a single character.