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 
   56namespace std _GLIBCXX_VISIBILITY(default)
 
   58_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   66_GLIBCXX_BEGIN_NAMESPACE_CXX11
 
   68#if __cplusplus == 201402L 
   70#elif __cplusplus > 201402L 
   81  template<
typename _CharT,
 
   82           typename _Ch = 
typename remove_const<_CharT>::type>
 
   83    using __is_encoded_char
 
   84      = __or_<is_same<_Ch, char>,
 
   85              is_same<_Ch, wchar_t>,
 
   86#ifdef _GLIBCXX_USE_CHAR8_T 
   87              is_same<_Ch, char8_t>,
 
   89              is_same<_Ch, char16_t>,
 
   90              is_same<_Ch, char32_t>>;
 
   92  template<
typename _Iter,
 
   94    using __is_path_iter_src
 
   95      = __and_<__is_encoded_char<typename _Iter_traits::value_type>,
 
   97                               typename _Iter_traits::iterator_category>>;
 
   99  template<
typename _Iter>
 
  100    static __is_path_iter_src<_Iter>
 
  101    __is_path_src(_Iter, 
int);
 
  103  template<
typename _CharT, 
typename _Traits, 
typename _Alloc>
 
  104    static __is_encoded_char<_CharT>
 
  105    __is_path_src(
const basic_string<_CharT, _Traits, _Alloc>&, 
int);
 
  107#if __cplusplus >= 201402L 
  108  template<
typename _CharT, 
typename _Traits>
 
  109    static __is_encoded_char<_CharT>
 
  110    __is_path_src(
const basic_string_view<_CharT, _Traits>&, 
int);
 
  113  template<
typename _Unknown>
 
  115    __is_path_src(
const _Unknown&, ...);
 
  117  template<
typename _Tp1, 
typename _Tp2>
 
  118    struct __constructible_from;
 
  120  template<
typename _Iter>
 
  121    struct __constructible_from<_Iter, _Iter>
 
  122    : __is_path_iter_src<_Iter>
 
  125  template<
typename _Source>
 
  126    struct __constructible_from<_Source, void>
 
  127    : decltype(__is_path_src(std::declval<const _Source&>(), 0))
 
  130  template<
typename _Tp1, 
typename _Tp2 = void,
 
  131           typename _Tp1_nocv = 
typename remove_cv<_Tp1>::type,
 
  132           typename _Tp1_noptr = 
typename remove_pointer<_Tp1>::type>
 
  133    using _Path = 
typename 
  135                            __not_<is_void<_Tp1_noptr>>,
 
  136                            __constructible_from<_Tp1, _Tp2>>::value,
 
  139  template<
typename _Source>
 
  141    _S_range_begin(_Source __begin) { 
return __begin; }
 
  143  struct __nul_terminated { };
 
  145  template<
typename _Source>
 
  146    inline __nul_terminated
 
  147    _S_range_end(_Source) { 
return {}; }
 
  149  template<
typename _CharT, 
typename _Traits, 
typename _Alloc>
 
  151    _S_range_begin(
const basic_string<_CharT, _Traits, _Alloc>& __str)
 
  152    { 
return __str.data(); }
 
  154  template<
typename _CharT, 
typename _Traits, 
typename _Alloc>
 
  156    _S_range_end(
const basic_string<_CharT, _Traits, _Alloc>& __str)
 
  157    { 
return __str.data() + __str.size(); }
 
  159#if __cplusplus >= 201402L 
  160  template<
typename _CharT, 
typename _Traits>
 
  162    _S_range_begin(
const basic_string_view<_CharT, _Traits>& __str)
 
  163    { 
return __str.data(); }
 
  165  template<
typename _CharT, 
typename _Traits>
 
  167    _S_range_end(
const basic_string_view<_CharT, _Traits>& __str)
 
  168    { 
return __str.data() + __str.size(); }
 
  171  template<
typename _Tp,
 
  172           typename _Iter = 
decltype(_S_range_begin(std::declval<_Tp>())),
 
  174           typename _UnqualVal = 
typename std::remove_const<_Val>::type>
 
  179  template<
typename _Tp,
 
  180           typename _Iter = 
decltype(_S_range_begin(std::declval<_Tp>())),
 
  182           typename _UnqualVal = 
typename std::remove_const<_Val>::type>
 
  186#ifdef _GLIBCXX_USE_CHAR8_T
 
  189      >::value, _UnqualVal>::type;
 
  204#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
  205    typedef wchar_t                             value_type;
 
  206    static constexpr value_type                 preferred_separator = L
'\\';
 
  208    typedef char                                value_type;
 
  209    static constexpr value_type                 preferred_separator = 
'/';
 
  219    path(string_type&& __source);
 
  221    template<
typename _Source,
 
  222             typename _Require = __detail::_Path<_Source>>
 
  223      path(_Source 
const& __source)
 
  224      : _M_pathname(_S_convert(__detail::_S_range_begin(__source),
 
  225                               __detail::_S_range_end(__source)))
 
  226      { _M_split_cmpts(); }
 
  228    template<
typename _InputIterator,
 
  229             typename _Require = __detail::_Path<_InputIterator, _InputIterator>>
 
  230      path(_InputIterator __first, _InputIterator __last)
 
  231      : _M_pathname(_S_convert(__first, __last))
 
  232      { _M_split_cmpts(); }
 
  234    template<
typename _Source,
 
  235             typename _Require = __detail::_Path<_Source>,
 
  236             typename _Require2 = __detail::__value_type_is_char<_Source>>
 
  237      path(_Source 
const& __source, 
const locale& __loc)
 
  238      : _M_pathname(_S_convert_loc(__detail::_S_range_begin(__source),
 
  239                                   __detail::_S_range_end(__source), __loc))
 
  240      { _M_split_cmpts(); }
 
  242    template<
typename _InputIterator,
 
  243             typename _Require = __detail::_Path<_InputIterator, _InputIterator>,
 
  244             typename _Require2 = __detail::__value_type_is_char<_InputIterator>>
 
  245      path(_InputIterator __first, _InputIterator __last, 
const locale& __loc)
 
  246      : _M_pathname(_S_convert_loc(__first, __last, __loc))
 
  247      { _M_split_cmpts(); }
 
  254    path& operator=(
path&& __p) 
noexcept;
 
  255    path& operator=(string_type&& __source);
 
  256    path& assign(string_type&& __source);
 
  258    template<
typename _Source>
 
  259      __detail::_Path<_Source>&
 
  260      operator=(_Source 
const& __source)
 
  261      { 
return *
this = 
path(__source); }
 
  263    template<
typename _Source>
 
  264      __detail::_Path<_Source>&
 
  265      assign(_Source 
const& __source)
 
  266      { 
return *
this = 
path(__source); }
 
  268    template<
typename _InputIterator>
 
  269      __detail::_Path<_InputIterator, _InputIterator>&
 
  270      assign(_InputIterator __first, _InputIterator __last)
 
  271      { 
return *
this = 
path(__first, __last); }
 
  275    path& operator/=(
const path& __p) { 
return _M_append(__p._M_pathname); }
 
  277    template<
typename _Source>
 
  278      __detail::_Path<_Source>&
 
  279      operator/=(_Source 
const& __source)
 
  280      { 
return append(__source); }
 
  282    template<
typename _Source>
 
  283      __detail::_Path<_Source>&
 
  284      append(_Source 
const& __source)
 
  286        return _M_append(_S_convert(__detail::_S_range_begin(__source),
 
  287                                    __detail::_S_range_end(__source)));
 
  290    template<
typename _InputIterator>
 
  291      __detail::_Path<_InputIterator, _InputIterator>&
 
  292      append(_InputIterator __first, _InputIterator __last)
 
  293      { 
return _M_append(_S_convert(__first, __last)); }
 
  298    path& operator+=(
const string_type& __x);
 
  299    path& operator+=(
const value_type* __x);
 
  300    path& operator+=(value_type __x);
 
  301#if __cplusplus >= 201402L 
  305    template<
typename _Source>
 
  306      __detail::_Path<_Source>&
 
  307      operator+=(_Source 
const& __x) { 
return concat(__x); }
 
  309    template<
typename _CharT>
 
  310      __detail::_Path<_CharT*, _CharT*>&
 
  311      operator+=(_CharT __x);
 
  313    template<
typename _Source>
 
  314      __detail::_Path<_Source>&
 
  315      concat(_Source 
const& __x)
 
  317        return *
this += _S_convert(__detail::_S_range_begin(__x),
 
  318                                   __detail::_S_range_end(__x));
 
  321    template<
typename _InputIterator>
 
  322      __detail::_Path<_InputIterator, _InputIterator>&
 
  323      concat(_InputIterator __first, _InputIterator __last)
 
  324      { 
return *
this += _S_convert(__first, __last); }
 
  328    void clear() 
noexcept { _M_pathname.clear(); _M_split_cmpts(); }
 
  330    path& make_preferred();
 
  331    path& remove_filename();
 
  332    path& replace_filename(
const path& __replacement);
 
  333    path& replace_extension(
const path& __replacement = 
path());
 
  335    void swap(
path& __rhs) 
noexcept;
 
  339    const string_type&  native() 
const noexcept { 
return _M_pathname; }
 
  340    const value_type*   c_str() 
const noexcept { 
return _M_pathname.c_str(); }
 
  341    operator string_type()
 const { 
return _M_pathname; }
 
  343    template<
typename _CharT, 
typename _Traits = std::
char_traits<_CharT>,
 
  344             typename _Allocator = std::allocator<_CharT>>
 
  346      string(
const _Allocator& __a = _Allocator()) 
const;
 
  349#if _GLIBCXX_USE_WCHAR_T 
  352#ifdef _GLIBCXX_USE_CHAR8_T 
  353    __attribute__((__abi_tag__(
"__u8")))
 
  354    std::u8string  u8string() 
const;
 
  362    template<
typename _CharT, 
typename _Traits = std::
char_traits<_CharT>,
 
  363             typename _Allocator = std::allocator<_CharT>>
 
  365      generic_string(
const _Allocator& __a = _Allocator()) 
const;
 
  368#if _GLIBCXX_USE_WCHAR_T 
  371#ifdef _GLIBCXX_USE_CHAR8_T 
  372    __attribute__((__abi_tag__(
"__u8")))
 
  373    std::u8string  generic_u8string() 
const;
 
  382    int compare(
const path& __p) 
const noexcept;
 
  383    int compare(
const string_type& __s) 
const;
 
  384    int compare(
const value_type* __s) 
const;
 
  385#if __cplusplus >= 201402L 
  391    path root_name() 
const;
 
  392    path root_directory() 
const;
 
  393    path root_path() 
const;
 
  394    path relative_path() 
const;
 
  395    path parent_path() 
const;
 
  396    path filename() 
const;
 
  398    path extension() 
const;
 
  402    _GLIBCXX_NODISCARD 
bool empty() 
const noexcept { 
return _M_pathname.empty(); }
 
  403    bool has_root_name() 
const;
 
  404    bool has_root_directory() 
const;
 
  405    bool has_root_path() 
const;
 
  406    bool has_relative_path() 
const;
 
  407    bool has_parent_path() 
const;
 
  408    bool has_filename() 
const;
 
  409    bool has_stem() 
const;
 
  410    bool has_extension() 
const;
 
  411    bool is_absolute() 
const;
 
  412    bool is_relative()
 const { 
return !is_absolute(); }
 
  423    template<
typename _InputIterator,
 
  426               = 
typename std::remove_cv<typename _Traits::value_type>::type>
 
  428      _S_string_from_iter(_InputIterator __source)
 
  431        for (_CharT __ch = *__source; __ch != _CharT(); __ch = *++__source)
 
  438    enum class _Type : 
unsigned char {
 
  439        _Multi, _Root_name, _Root_dir, _Filename
 
  442    path(string_type __str, _Type __type);
 
  444    enum class _Split { _Stem, _Extension };
 
  446    path& _M_append(
const string_type& __str)
 
  448      if (!_M_pathname.empty() && !_S_is_dir_sep(_M_pathname.back())
 
  449          && !__str.empty() && !_S_is_dir_sep(__str.front()))
 
  450        _M_pathname += preferred_separator;
 
  451      _M_pathname += __str;
 
  458    template<
typename _CharT>
 
  462    _S_convert(value_type* __src, __detail::__nul_terminated)
 
  463    { 
return string_type(__src); }
 
  466    _S_convert(
const value_type* __src, __detail::__nul_terminated)
 
  467    { 
return string_type(__src); }
 
  469    template<
typename _Iter>
 
  471      _S_convert(_Iter __first, _Iter __last)
 
  474        return _Cvt<typename remove_cv<__value_type>::type>::
 
  475          _S_convert(__first, __last);
 
  478    template<
typename _InputIterator>
 
  480      _S_convert(_InputIterator __src, __detail::__nul_terminated)
 
  482        auto __s = _S_string_from_iter(__src);
 
  483        return _S_convert(__s.c_str(), __s.c_str() + __s.size());
 
  487    _S_convert_loc(
const char* __first, 
const char* __last,
 
  491    _S_convert_loc(
char* __first, 
char* __last, 
const std::locale& __loc)
 
  493      return _S_convert_loc(
const_cast<const char*
>(__first),
 
  494                            const_cast<const char*
>(__last), __loc);
 
  497    template<
typename _Iter>
 
  499      _S_convert_loc(_Iter __first, _Iter __last, 
const std::locale& __loc)
 
  502        return _S_convert_loc(__str.
data(), __str.
data()+__str.
size(), __loc);
 
  505    template<
typename _InputIterator>
 
  507      _S_convert_loc(_InputIterator __src, __detail::__nul_terminated,
 
  510        const std::string __s = _S_string_from_iter(__src);
 
  511        return _S_convert_loc(__s.
data(), __s.
data() + __s.
size(), __loc);
 
  514    static bool _S_is_dir_sep(value_type __ch)
 
  516#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
  517      return __ch == L
'/' || __ch == preferred_separator;
 
  523    void _M_split_cmpts();
 
  525    void _M_add_root_name(
size_t __n);
 
  526    void _M_add_root_dir(
size_t __pos);
 
  527    void _M_add_filename(
size_t __pos, 
size_t __n);
 
  529    string_type _M_pathname;
 
  532    using _List = _GLIBCXX_STD_C::vector<_Cmpt>;
 
  534    _Type _M_type = _Type::_Multi;
 
  540  inline void swap(
path& __lhs, 
path& __rhs) 
noexcept { __lhs.swap(__rhs); }
 
  543  size_t hash_value(
const path& __p) 
noexcept;
 
  546  inline bool operator<(
const path& __lhs, 
const path& __rhs) 
noexcept;
 
  549  inline bool operator<=(
const path& __lhs, 
const path& __rhs) 
noexcept 
  550  { 
return !(__rhs < __lhs); }
 
  553  inline bool operator>(
const path& __lhs, 
const path& __rhs) 
noexcept 
  554  { 
return __rhs < __lhs; }
 
  557  inline bool operator>=(
const path& __lhs, 
const path& __rhs) 
noexcept 
  558  { 
return !(__lhs < __rhs); }
 
  561  inline bool operator==(
const path& __lhs, 
const path& __rhs) 
noexcept;
 
  564  inline bool operator!=(
const path& __lhs, 
const path& __rhs) 
noexcept 
  565  { 
return !(__lhs == __rhs); }
 
  568  inline path 
operator/(
const path& __lhs, 
const path& __rhs)
 
  570    path __result(__lhs);
 
  576  template<
typename _CharT, 
typename _Traits>
 
  577    basic_ostream<_CharT, _Traits>&
 
  578    operator<<(basic_ostream<_CharT, _Traits>& __os, 
const path& __p)
 
  580      auto __tmp = __p.string<_CharT, _Traits>();
 
  581      using __quoted_string
 
  583      __os << __quoted_string{__tmp, _CharT(
'"'), _CharT(
'\\')};
 
  588  template<
typename _CharT, 
typename _Traits>
 
  589    basic_istream<_CharT, _Traits>&
 
  590    operator>>(basic_istream<_CharT, _Traits>& __is, path& __p)
 
  592      basic_string<_CharT, _Traits> __tmp;
 
  593      using __quoted_string
 
  595      if (__is >> __quoted_string{ __tmp, _CharT(
'"'), _CharT(
'\\') })
 
  601#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
  602  template<
typename _InputIterator>
 
  604    __u8path(_InputIterator __first, _InputIterator __last, 
char)
 
  607      std::codecvt_utf8_utf16<path::value_type> __cvt;
 
  608      path::string_type __tmp;
 
  610      const char* 
const __ptr = __u8str.
data();
 
  611      if (__str_codecvt_in_all(__ptr, __ptr + __u8str.size(), __tmp, __cvt))
 
  612        return path{ __tmp };
 
  613      _GLIBCXX_THROW_OR_ABORT(filesystem_error(
 
  614            "Cannot convert character sequence",
 
  618#ifdef _GLIBCXX_USE_CHAR8_T 
  619  template<
typename _InputIterator>
 
  621    __u8path(_InputIterator __first, _InputIterator __last, 
char8_t)
 
  623      return path{ __first, __last };
 
  628  template<
typename _InputIterator,
 
  629           typename _Require = __detail::_Path<_InputIterator, _InputIterator>,
 
  631             __detail::__value_type_is_char_or_char8_t<_InputIterator>>
 
  633    u8path(_InputIterator __first, _InputIterator __last)
 
  635#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
  636      return __u8path(__first, __last, _CharT{});
 
  638      return path{ __first, __last };
 
  643#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
  645  __u8path(
const string& __s, 
char)
 
  647    return filesystem::u8path(__s.data(), __s.data() + __s.size());
 
  650  template<
typename _Source>
 
  651    inline __enable_if_t<is_convertible<const _Source&, string>::value, path>
 
  652    __u8path(
const _Source& __source, 
char)
 
  655      return filesystem::u8path(__s.
data(), __s.
data() + __s.
size());
 
  658  template<
typename _Source>
 
  659    inline __enable_if_t<!is_convertible<const _Source&, string>::value, path>
 
  660    __u8path(
const _Source& __source, 
char)
 
  662      std::string __s = path::_S_string_from_iter(__source);
 
  663      return filesystem::u8path(__s.
data(), __s.
data() + __s.
size());
 
  666#ifdef _GLIBCXX_USE_CHAR8_T 
  667  template<
typename _Source>
 
  669    __u8path(
const _Source& __source, 
char8_t)
 
  671      return path{ __source };
 
  676  template<
typename _Source,
 
  677           typename _Require = __detail::_Path<_Source>,
 
  679             __detail::__value_type_is_char_or_char8_t<_Source>>
 
  681    u8path(
const _Source& __source)
 
  683#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
  684      return __u8path(__source, _CharT{});
 
  686      return path{ __source };
 
  705    : 
system_error(__ec, __what_arg), _M_path1(__p1), _M_path2(__p2)
 
  710    const path& path1() 
const noexcept { 
return _M_path1; }
 
  711    const path& path2() 
const noexcept { 
return _M_path2; }
 
  712    const char* 
what() const noexcept { 
return _M_what.
c_str(); }
 
  723  struct path::_Cmpt : 
path 
  725    _Cmpt(string_type __s, _Type __t, 
size_t __pos)
 
  726      : 
path(
std::move(__s), __t), _M_pos(__pos) { }
 
  728    _Cmpt() : _M_pos(-1) { }
 
  735    struct path::_Cvt<path::value_type>
 
  740      using __codecvt_utf8_to_wide = _Cvt;
 
  742      template<
typename _WStr>
 
  744        __str_codecvt_in_all(
const char*, 
const char*,
 
  745                             _WStr&, __codecvt_utf8_to_wide&) 
noexcept 
  748      template<
typename _Iter>
 
  750        _S_convert(_Iter __first, _Iter __last)
 
  751        { 
return string_type{__first, __last}; }
 
  755  template<
typename _CharT>
 
  761      using __codecvt_utf8_to_wchar
 
  762        = __conditional_t<
sizeof(wchar_t) == 
sizeof(
char32_t),
 
  763                          std::codecvt_utf8<wchar_t>,        
 
  764                          std::codecvt_utf8_utf16<wchar_t>>; 
 
  768      struct __codecvt_utf8_to_utfNN : 
std::codecvt<_CharT, char, mbstate_t>
 
  773      using __codecvt_utf8_to_wide
 
  774        = __conditional_t<is_same<_CharT, wchar_t>::value,
 
  775                          __codecvt_utf8_to_wchar,
 
  776                          __codecvt_utf8_to_utfNN>;
 
  778#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
  779#ifdef _GLIBCXX_USE_CHAR8_T 
  781      _S_wconvert(
const char8_t* __f, 
const char8_t* __l, 
const char8_t*)
 
  783        const char* __f2 = (
const char*)__f;
 
  784        const char* __l2 = (
const char*)__l;
 
  786        std::codecvt_utf8_utf16<wchar_t> __wcvt;
 
  787        if (__str_codecvt_in_all(__f2, __l2, __wstr, __wcvt))
 
  793      _S_wconvert(
const char* __f, 
const char* __l, 
const char*)
 
  795        std::codecvt_utf8_utf16<wchar_t> __cvt;
 
  797        if (__str_codecvt_in_all(__f, __l, __wstr, __cvt))
 
  799        _GLIBCXX_THROW_OR_ABORT(filesystem_error(
 
  800              "Cannot convert character sequence",
 
  805      _S_wconvert(
const _CharT* __f, 
const _CharT* __l, 
const void*)
 
  807        __codecvt_utf8_to_wide __cvt;
 
  809        if (__str_codecvt_out_all(__f, __l, __str, __cvt))
 
  811            const char* __f2 = __str.
data();
 
  812            const char* __l2 = __f2 + __str.
size();
 
  813            std::codecvt_utf8_utf16<wchar_t> __wcvt;
 
  815            if (__str_codecvt_in_all(__f2, __l2, __wstr, __wcvt))
 
  818        _GLIBCXX_THROW_OR_ABORT(filesystem_error(
 
  819              "Cannot convert character sequence",
 
  824      _S_convert(
const _CharT* __f, 
const _CharT* __l)
 
  826        return _S_wconvert(__f, __l, (
const _CharT*)
nullptr);
 
  830      _S_convert(
const _CharT* __f, 
const _CharT* __l)
 
  832#ifdef _GLIBCXX_USE_CHAR8_T 
  833        if constexpr (is_same<_CharT, char8_t>::value)
 
  834          return string_type(__f, __l);
 
  838            __codecvt_utf8_to_wide __cvt;
 
  840            if (__str_codecvt_out_all(__f, __l, __str, __cvt))
 
  842            _GLIBCXX_THROW_OR_ABORT(filesystem_error(
 
  843                  "Cannot convert character sequence",
 
  850      _S_convert(_CharT* __f, _CharT* __l)
 
  852        return _S_convert(
const_cast<const _CharT*
>(__f),
 
  853                          const_cast<const _CharT*
>(__l));
 
  856      template<
typename _Iter>
 
  858        _S_convert(_Iter __first, _Iter __last)
 
  861          return _S_convert(__str.
data(), __str.
data() + __str.
size());
 
  864      template<
typename _Iter, 
typename _Cont>
 
  866        _S_convert(__gnu_cxx::__normal_iterator<_Iter, _Cont> __first,
 
  867                  __gnu_cxx::__normal_iterator<_Iter, _Cont> __last)
 
  868        { 
return _S_convert(__first.base(), __last.base()); }
 
  876    using difference_type       = std::ptrdiff_t;
 
  882    iterator() noexcept : _M_path(
nullptr), _M_cur(), _M_at_end() { }
 
  893    { 
auto __tmp = *
this; ++*
this; 
return __tmp; }
 
  898    { 
auto __tmp = *
this; --*
this; 
return __tmp; }
 
  902    { 
return __lhs._M_equals(__rhs); }
 
  906    { 
return !__lhs._M_equals(__rhs); }
 
  911    iterator(
const path* __path, path::_List::const_iterator __iter) noexcept
 
  912    : _M_path(__path), _M_cur(__iter), _M_at_end()
 
  916    : _M_path(__path), _M_cur(), _M_at_end(__at_end)
 
  919    bool _M_equals(
iterator) 
const noexcept;
 
  922    path::_List::const_iterator _M_cur;
 
  927  path::path() noexcept = default;
 
  934  : _M_pathname(
std::
move(__p._M_pathname)),
 
  935    _M_cmpts(__p._M_cmpts),
 
  940  path::path(string_type&& __source)
 
  941  : _M_pathname(
std::
move(__source))
 
  942  { _M_split_cmpts(); }
 
  945  path::path(string_type __str, _Type __type)
 
  946  : _M_pathname(__str), _M_type(__type)
 
  948    __glibcxx_assert(!empty());
 
  949    __glibcxx_assert(_M_type != _Type::_Multi);
 
  953  path::~path() = 
default;
 
  956  path::operator=(
const path& __p) = 
default;
 
  959  path::operator=(path&& __p) 
noexcept 
  961    _M_pathname = 
std::move(__p._M_pathname);
 
  963    _M_type = __p._M_type;
 
  969  path::operator=(string_type&& __source)
 
  970  { 
return *
this = path(
std::move(__source)); }
 
  973  path::assign(string_type&& __source)
 
  974  { 
return *
this = path(
std::move(__source)); }
 
  977  path::operator+=(
const path& __p)
 
  979    return operator+=(__p.native());
 
  983  path::operator+=(
const string_type& __x)
 
  991  path::operator+=(
const value_type* __x)
 
  999  path::operator+=(value_type __x)
 
 1006#if __cplusplus >= 201402L 
 1008  path::operator+=(basic_string_view<value_type> __x)
 
 1010    _M_pathname.append(__x.data(), __x.size());
 
 1016  template<
typename _CharT>
 
 1017    inline __detail::_Path<_CharT*, _CharT*>&
 
 1018    path::operator+=(_CharT __x)
 
 1021      return concat(__addr, __addr + 1);
 
 1025  path::make_preferred()
 
 1027#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
 1028    std::replace(_M_pathname.begin(), _M_pathname.end(), L
'/',
 
 1029                 preferred_separator);
 
 1034  inline void path::swap(path& __rhs) 
noexcept 
 1036    _M_pathname.swap(__rhs._M_pathname);
 
 1037    _M_cmpts.swap(__rhs._M_cmpts);
 
 1041  template<
typename _CharT, 
typename _Traits, 
typename _Allocator>
 
 1043    path::string(
const _Allocator& __a)
 const 
 1045      if _GLIBCXX_CONSTEXPR (is_same<_CharT, value_type>::value)
 
 1046        return { _M_pathname.
begin(), _M_pathname.end(), __a };
 
 1048      using _WString = basic_string<_CharT, _Traits, _Allocator>;
 
 1050      const value_type* __first = _M_pathname.data();
 
 1051      const value_type* __last = __first + _M_pathname.size();
 
 1053#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
 1054      using _CharAlloc = __alloc_rebind<_Allocator, char>;
 
 1055      using _String = basic_string<char, char_traits<char>, _CharAlloc>;
 
 1059      codecvt_utf8_utf16<value_type> __cvt;
 
 1060      _String __u8str{_CharAlloc{__a}};
 
 1061      if (__str_codecvt_out_all(__first, __last, __u8str, __cvt))
 
 1066            operator()(
const _String& __from, _String&, 
true_type)
 
 1070            operator()(
const _String& __from, _WString& __to, 
false_type)
 
 1072#ifdef _GLIBCXX_USE_CHAR8_T 
 1073              if constexpr (is_same<_CharT, char8_t>::value)
 
 1075                  __to.assign(__from.begin(), __from.end());
 
 1082                  typename path::_Cvt<_CharT>::__codecvt_utf8_to_wide __cvt;
 
 1083                  const char* __f = __from.data();
 
 1084                  const char* __l = __f + __from.size();
 
 1085                  if (__str_codecvt_in_all(__f, __l, __to, __cvt))
 
 1091          _WString __wstr(__a);
 
 1092          if (
auto* __p = __dispatch(__u8str, __wstr, is_same<_CharT, char>{}))
 
 1096#ifdef _GLIBCXX_USE_CHAR8_T 
 1097      if constexpr (is_same<_CharT, char8_t>::value)
 
 1098          return _WString(__first, __last, __a);
 
 1102          typename path::_Cvt<_CharT>::__codecvt_utf8_to_wide __cvt;
 
 1103          _WString __wstr(__a);
 
 1104          if (__str_codecvt_in_all(__first, __last, __wstr, __cvt))
 
 1108      _GLIBCXX_THROW_OR_ABORT(filesystem_error(
 
 1109            "Cannot convert character sequence",
 
 1114  path::string()
 const { 
return string<char>(); }
 
 1116#if _GLIBCXX_USE_WCHAR_T 
 1118  path::wstring()
 const { 
return string<wchar_t>(); }
 
 1121#ifdef _GLIBCXX_USE_CHAR8_T 
 1122  inline std::u8string
 
 1123  path::u8string()
 const { 
return string<char8_t>(); }
 
 1126  path::u8string()
 const 
 1128#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
 1131    std::codecvt_utf8_utf16<value_type> __cvt;
 
 1132    const value_type* __first = _M_pathname.data();
 
 1133    const value_type* __last = __first + _M_pathname.size();
 
 1134    if (__str_codecvt_out_all(__first, __last, __str, __cvt))
 
 1136    _GLIBCXX_THROW_OR_ABORT(filesystem_error(
 
 1137          "Cannot convert character sequence",
 
 1146  path::u16string()
 const { 
return string<char16_t>(); }
 
 1149  path::u32string()
 const { 
return string<char32_t>(); }
 
 1151  template<
typename _CharT, 
typename _Traits, 
typename _Allocator>
 
 1153    path::generic_string(
const _Allocator& __a)
 const 
 1155#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
 1156      const _CharT __slash = is_same<_CharT, wchar_t>::value
 
 1160      const _CharT __slash = _CharT(
'/');
 
 1162      basic_string<_CharT, _Traits, _Allocator> __str(__a);
 
 1163      __str.
reserve(_M_pathname.size());
 
 1164      bool __add_slash = 
false;
 
 1165      for (
auto& __elem : *
this)
 
 1167          if (__elem._M_type == _Type::_Root_dir)
 
 1174          __str += __elem.string<_CharT, _Traits, _Allocator>(__a);
 
 1175          __add_slash = __elem._M_type == _Type::_Filename;
 
 1181  path::generic_string()
 const { 
return generic_string<char>(); }
 
 1183#if _GLIBCXX_USE_WCHAR_T 
 1185  path::generic_wstring()
 const { 
return generic_string<wchar_t>(); }
 
 1188#ifdef _GLIBCXX_USE_CHAR8_T 
 1189  inline std::u8string
 
 1190  path::generic_u8string()
 const { 
return generic_string<char8_t>(); }
 
 1193  path::generic_u8string()
 const { 
return generic_string<char>(); }
 
 1197  path::generic_u16string()
 const { 
return generic_string<char16_t>(); }
 
 1200  path::generic_u32string()
 const { 
return generic_string<char32_t>(); }
 
 1203  path::compare(
const string_type& __s)
 const { 
return compare(path(__s)); }
 
 1206  path::compare(
const value_type* __s)
 const { 
return compare(path(__s)); }
 
 1208#if __cplusplus >= 201402L 
 1210  path::compare(basic_string_view<value_type> __s)
 const 
 1211  { 
return compare(path(__s)); }
 
 1215  path::filename()
 const { 
return empty() ? path() : *--end(); }
 
 1220    auto ext = _M_find_extension();
 
 1221    if (ext.first && ext.second != 0)
 
 1222      return path{ext.first->substr(0, ext.second)};
 
 1227  path::extension()
 const 
 1229    auto ext = _M_find_extension();
 
 1231      return path{ext.first->substr(ext.second)};
 
 1236  path::has_stem()
 const 
 1238    auto ext = _M_find_extension();
 
 1239    return ext.first && ext.second != 0;
 
 1243  path::has_extension()
 const 
 1245    auto ext = _M_find_extension();
 
 1250  path::is_absolute()
 const 
 1252#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
 1253    return has_root_name() && has_root_directory();
 
 1255    return has_root_directory();
 
 1259  inline path::iterator
 
 1260  path::begin() const noexcept
 
 1262    if (_M_type == _Type::_Multi)
 
 1263      return iterator(
this, _M_cmpts.begin());
 
 1264    return iterator(
this, 
false);
 
 1267  inline path::iterator
 
 1268  path::end() const noexcept
 
 1270    if (_M_type == _Type::_Multi)
 
 1271      return iterator(
this, _M_cmpts.end());
 
 1272    return iterator(
this, 
true);
 
 1275  inline path::iterator&
 
 1276  path::iterator::operator++() noexcept
 
 1278    __glibcxx_assert(_M_path != 
nullptr);
 
 1279    if (_M_path->_M_type == _Type::_Multi)
 
 1281        __glibcxx_assert(_M_cur != _M_path->_M_cmpts.end());
 
 1286        __glibcxx_assert(!_M_at_end);
 
 1292  inline path::iterator&
 
 1293  path::iterator::operator--() noexcept
 
 1295    __glibcxx_assert(_M_path != 
nullptr);
 
 1296    if (_M_path->_M_type == _Type::_Multi)
 
 1298        __glibcxx_assert(_M_cur != _M_path->_M_cmpts.begin());
 
 1303        __glibcxx_assert(_M_at_end);
 
 1309  inline path::iterator::reference
 
 1310  path::iterator::operator*() const noexcept
 
 1312    __glibcxx_assert(_M_path != 
nullptr);
 
 1313    if (_M_path->_M_type == _Type::_Multi)
 
 1315        __glibcxx_assert(_M_cur != _M_path->_M_cmpts.end());
 
 1322  path::iterator::_M_equals(iterator __rhs) 
const noexcept 
 1324    if (_M_path != __rhs._M_path)
 
 1326    if (_M_path == 
nullptr)
 
 1328    if (_M_path->_M_type == path::_Type::_Multi)
 
 1329      return _M_cur == __rhs._M_cur;
 
 1330    return _M_at_end == __rhs._M_at_end;
 
 1337  inline bool operator<(
const path& __lhs, 
const path& __rhs) 
noexcept 
 1338  { 
return __lhs.compare(__rhs) < 0; }
 
 1340  inline bool operator==(
const path& __lhs, 
const path& __rhs) 
noexcept 
 1341  { 
return __lhs.compare(__rhs) == 0; }
 
 1344_GLIBCXX_END_NAMESPACE_CXX11
 
 1349_GLIBCXX_END_NAMESPACE_VERSION
 
constexpr complex< _Tp > operator/(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x divided by y.
 
error_code make_error_code(future_errc __errc) noexcept
Overload of make_error_code for future_errc.
 
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
 
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
 
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
 
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
 
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
 
basic_string< char > string
A string of char.
 
basic_string< char32_t > u32string
A string of char32_t.
 
basic_string< char16_t > u16string
A string of char16_t.
 
basic_string< wchar_t > wstring
A string of wchar_t.
 
ISO C++ entities toplevel namespace is std.
 
constexpr auto empty(const _Container &__cont) noexcept(noexcept(__cont.empty())) -> decltype(__cont.empty())
Return whether a container is empty.
 
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
Global I/O operators for bitsets.
 
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)
Global I/O operators for bitsets.
 
A non-owning reference to a string.
 
An exception type that includes an error_code value.
 
Define a member typedef type only if a boolean constant is true.
 
Primary class template codecvt.
 
Managing sequences of characters and character-like objects.
 
void push_back(_CharT __c)
Append a single character.
 
const _CharT * data() const noexcept
Return const pointer to contents.
 
void reserve(size_type __res_arg)
Attempt to preallocate enough memory for specified number of characters.
 
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
 
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
 
static const size_type npos
Value returned by various member functions when they fail.
 
Traits class for iterators.
 
Container class for localization functionality.
 
Struct for delimited strings.
 
Struct holding two objects of arbitrary type.
 
Bidirectional iterators support a superset of forward iterator operations.
 
Exception type thrown by the Filesystem TS library.
 
const char * what() const noexcept
 
An iterator for the components of a path.
 
A non-owning reference to a string.