30#ifndef _GLIBCXX_FS_PATH_H 
   31#define _GLIBCXX_FS_PATH_H 1 
   33#if __cplusplus >= 201703L 
   46#include <bits/shared_ptr.h> 
   49#if __cplusplus > 201703L 
   53#if defined(_WIN32) && !defined(__CYGWIN__) 
   54# define _GLIBCXX_FILESYSTEM_IS_WINDOWS 1 
   58namespace std _GLIBCXX_VISIBILITY(default)
 
   60_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   64_GLIBCXX_BEGIN_NAMESPACE_CXX11
 
   73  template<
typename _CharT>
 
   74    inline constexpr bool __is_encoded_char = 
false;
 
   76    inline constexpr bool __is_encoded_char<char> = 
true;
 
   77#ifdef _GLIBCXX_USE_CHAR8_T 
   79    inline constexpr bool __is_encoded_char<char8_t> = 
true;
 
   81#if _GLIBCXX_USE_WCHAR_T 
   83    inline constexpr bool __is_encoded_char<wchar_t> = 
true;
 
   86    inline constexpr bool __is_encoded_char<char16_t> = 
true;
 
   88    inline constexpr bool __is_encoded_char<char32_t> = 
true;
 
   90#if __cpp_concepts >= 201907L 
   91  template<
typename _Iter>
 
   94  template<
typename _Iter>
 
   99  template<> 
struct __safe_iterator_traits<void*> { };
 
  100  template<> 
struct __safe_iterator_traits<const void*> { };
 
  101  template<> 
struct __safe_iterator_traits<volatile void*> { };
 
  102  template<> 
struct __safe_iterator_traits<const volatile void*> { };
 
  105  template<
typename _Iter_traits, 
typename = 
void>
 
  106    struct __is_path_iter_src
 
  110  template<
typename _Iter_traits>
 
  111    struct __is_path_iter_src<_Iter_traits,
 
  112                              void_t<typename _Iter_traits::value_type>>
 
  113    : 
bool_constant<__is_encoded_char<typename _Iter_traits::value_type>>
 
  116  template<
typename _Source>
 
  117    inline constexpr bool __is_path_src
 
  118      = __is_path_iter_src<iterator_traits<decay_t<_Source>>>::value;
 
  121    inline constexpr bool __is_path_src<path> = 
false;
 
  124    inline constexpr bool __is_path_src<volatile path> = 
false;
 
  127    inline constexpr bool __is_path_src<void*> = 
false;
 
  130    inline constexpr bool __is_path_src<const void*> = 
false;
 
  133    inline constexpr bool __is_path_src<volatile void*> = 
false;
 
  136    inline constexpr bool __is_path_src<const volatile void*> = 
false;
 
  138  template<
typename _CharT, 
typename _Traits, 
typename _Alloc>
 
  139    inline constexpr bool 
  140      __is_path_src<basic_string<_CharT, _Traits, _Alloc>>
 
  141        = __is_encoded_char<_CharT>;
 
  143  template<
typename _CharT, 
typename _Traits>
 
  144    inline constexpr bool 
  145      __is_path_src<basic_string_view<_CharT, _Traits>>
 
  146        = __is_encoded_char<_CharT>;
 
  149  template<
typename _Tp>
 
  150    using _Path = enable_if_t<__is_path_src<_Tp>, path>;
 
  153  template<
typename _Iter, 
typename _Tr = __safe_iterator_traits<_Iter>>
 
  154    using _Path2 = enable_if_t<__is_path_iter_src<_Tr>::value, path>;
 
  160  template<
typename _CharT, 
typename _Traits, 
typename _Alloc>
 
  161    inline basic_string_view<_CharT, _Traits>
 
  162    __effective_range(
const basic_string<_CharT, _Traits, _Alloc>& __source)
 
  165  template<
typename _CharT, 
typename _Traits>
 
  166    inline const basic_string_view<_CharT, _Traits>&
 
  167    __effective_range(
const basic_string_view<_CharT, _Traits>& __source)
 
  170  template<
typename _Source>
 
  172    __effective_range(
const _Source& __source)
 
  174      if constexpr (is_pointer_v<decay_t<_Source>>)
 
  175        return basic_string_view{&*__source};
 
  181            = 
typename iterator_traits<_Source>::value_type;
 
  182          basic_string<value_type> __str;
 
  183          _Source __it = __source;
 
  184          for (value_type __ch = *__it; __ch != value_type(); __ch = *++__it)
 
  185            __str.push_back(__ch);
 
  191  template<
typename _Tp>
 
  193      decltype(__detail::__effective_range(std::declval<_Tp>()))>::value_type;
 
  198  template<
typename _Tp, 
typename _Val = __value_t<_Tp>>
 
  199    using __value_type_is_char
 
  204  template<
typename _Tp, 
typename _Val = __value_t<_Tp>>
 
  205    using __value_type_is_char_or_char8_t
 
  207#ifdef _GLIBCXX_USE_CHAR8_T 
  208                         || std::is_same_v<_Val, char8_t>
 
  213  template<
typename _InputIterator>
 
  215    __string_from_range(_InputIterator __first, _InputIterator __last)
 
  219      static_assert(__is_encoded_char<_EcharT>);
 
  221#if __cpp_lib_concepts 
  222      constexpr bool __contiguous = std::contiguous_iterator<_InputIterator>;
 
  224      constexpr bool __contiguous
 
  225        = is_pointer_v<
decltype(std::__niter_base(__first))>;
 
  227      if constexpr (__contiguous)
 
  230          const auto* __f = std::__to_address(std::__niter_base(__first));
 
  231          const auto* __l = std::__to_address(std::__niter_base(__last));
 
  232          return basic_string_view<_EcharT>(__f, __l - __f);
 
  236        return basic_string<_EcharT>(__first, __last);
 
  251#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
  252    using value_type = wchar_t;
 
  253    static constexpr value_type preferred_separator = L
'\\';
 
  255# ifdef _GLIBCXX_DOXYGEN 
  257    using value_type = __os_dependent__;
 
  259    using value_type =  char;
 
  261    static constexpr value_type preferred_separator = 
'/';
 
  266    enum format : 
unsigned char { native_format, generic_format, auto_format };
 
  272    path(
const path& __p) = 
default;
 
  275#if _GLIBCXX_USE_CXX11_ABI || _GLIBCXX_FULLY_DYNAMIC_STRING == 0 
  278    : _M_pathname(
std::move(__p._M_pathname)),
 
  282    path(string_type&& __source, 
format = auto_format)
 
  283    : _M_pathname(
std::
move(__source))
 
  284    { _M_split_cmpts(); }
 
  286    template<
typename _Source,
 
  287             typename _Require = __detail::_Path<_Source>>
 
  288      path(_Source 
const& __source, 
format = auto_format)
 
  289      : _M_pathname(_S_convert(__detail::__effective_range(__source)))
 
  290      { _M_split_cmpts(); }
 
  292    template<
typename _InputIterator,
 
  293             typename _Require = __detail::_Path2<_InputIterator>>
 
  294      path(_InputIterator __first, _InputIterator __last, 
format = auto_format)
 
  295      : _M_pathname(_S_convert(__detail::__string_from_range(__first, __last)))
 
  296      { _M_split_cmpts(); }
 
  298    template<
typename _Source,
 
  299             typename _Require = __detail::_Path<_Source>,
 
  300             typename _Require2 = __detail::__value_type_is_char<_Source>>
 
  301      path(_Source 
const& __src, 
const locale& __loc, 
format = auto_format)
 
  302      : _M_pathname(_S_convert_loc(__detail::__effective_range(__src), __loc))
 
  303      { _M_split_cmpts(); }
 
  305    template<
typename _InputIterator,
 
  306             typename _Require = __detail::_Path2<_InputIterator>,
 
  307             typename _Req2 = __detail::__value_type_is_char<_InputIterator>>
 
  308      path(_InputIterator __first, _InputIterator __last, 
const locale& __loc,
 
  310      : _M_pathname(_S_convert_loc(__first, __last, __loc))
 
  311      { _M_split_cmpts(); }
 
  317    path& operator=(
const path&);
 
  318    path& operator=(path&&) noexcept;
 
  319    path& operator=(string_type&& __source);
 
  320    path& assign(string_type&& __source);
 
  322    template<typename _Source>
 
  323      __detail::_Path<_Source>&
 
  324      operator=(_Source const& __source)
 
  325      { 
return *
this = path(__source); }
 
  327    template<
typename _Source>
 
  328      __detail::_Path<_Source>&
 
  329      assign(_Source 
const& __source)
 
  330      { 
return *
this = path(__source); }
 
  332    template<
typename _InputIterator>
 
  333      __detail::_Path2<_InputIterator>&
 
  334      assign(_InputIterator __first, _InputIterator __last)
 
  335      { 
return *
this = path(__first, __last); }
 
  339    path& operator/=(
const path& __p);
 
  341    template<
typename _Source>
 
  342      __detail::_Path<_Source>&
 
  343      operator/=(_Source 
const& __source)
 
  345        _M_append(_S_convert(__detail::__effective_range(__source)));
 
  349    template<
typename _Source>
 
  350      __detail::_Path<_Source>&
 
  351      append(_Source 
const& __source)
 
  353        _M_append(_S_convert(__detail::__effective_range(__source)));
 
  357    template<
typename _InputIterator>
 
  358      __detail::_Path2<_InputIterator>&
 
  359      append(_InputIterator __first, _InputIterator __last)
 
  361        _M_append(_S_convert(__detail::__string_from_range(__first, __last)));
 
  367    path& operator+=(
const path& __x);
 
  368    path& operator+=(
const string_type& __x);
 
  369    path& operator+=(
const value_type* __x);
 
  370    path& operator+=(value_type __x);
 
  371    path& operator+=(basic_string_view<value_type> __x);
 
  373    template<
typename _Source>
 
  374      __detail::_Path<_Source>&
 
  375      operator+=(_Source 
const& __x) { 
return concat(__x); }
 
  377    template<
typename _CharT>
 
  378      __detail::_Path2<_CharT*>&
 
  379      operator+=(_CharT __x);
 
  381    template<
typename _Source>
 
  382      __detail::_Path<_Source>&
 
  383      concat(_Source 
const& __x)
 
  385        _M_concat(_S_convert(__detail::__effective_range(__x)));
 
  389    template<
typename _InputIterator>
 
  390      __detail::_Path2<_InputIterator>&
 
  391      concat(_InputIterator __first, _InputIterator __last)
 
  393        _M_concat(_S_convert(__detail::__string_from_range(__first, __last)));
 
  399    void clear() noexcept { _M_pathname.
clear(); _M_split_cmpts(); }
 
  401    path& make_preferred();
 
  402    path& remove_filename();
 
  403    path& replace_filename(
const path& __replacement);
 
  404    path& replace_extension(
const path& __replacement = path());
 
  406    void swap(path& __rhs) 
noexcept;
 
  410    const string_type&  native() const noexcept { 
return _M_pathname; }
 
  411    const value_type*   c_str() const noexcept { 
return _M_pathname.
c_str(); }
 
  412    operator string_type()
 const { 
return _M_pathname; }
 
  414    template<
typename _CharT, 
typename _Traits = std::
char_traits<_CharT>,
 
  415             typename _Allocator = std::allocator<_CharT>>
 
  417      string(
const _Allocator& __a = _Allocator()) 
const;
 
  420#if _GLIBCXX_USE_WCHAR_T 
  423#ifdef _GLIBCXX_USE_CHAR8_T 
  424    __attribute__((__abi_tag__(
"__u8")))
 
  425    std::u8string  u8string() const;
 
  433    template<
typename _CharT, 
typename _Traits = std::
char_traits<_CharT>,
 
  434             typename _Allocator = std::allocator<_CharT>>
 
  436      generic_string(
const _Allocator& __a = _Allocator()) 
const;
 
  439#if _GLIBCXX_USE_WCHAR_T 
  442#ifdef _GLIBCXX_USE_CHAR8_T 
  443    __attribute__((__abi_tag__(
"__u8")))
 
  444    std::u8string  generic_u8string() const;
 
  453    int compare(
const path& __p) 
const noexcept;
 
  454    int compare(
const string_type& __s) 
const noexcept;
 
  455    int compare(
const value_type* __s) 
const noexcept;
 
  456    int compare(basic_string_view<value_type> __s) 
const noexcept;
 
  460    path root_name() 
const;
 
  461    path root_directory() 
const;
 
  462    path root_path() 
const;
 
  463    path relative_path() 
const;
 
  464    path parent_path() 
const;
 
  465    path filename() 
const;
 
  467    path extension() 
const;
 
  471    [[nodiscard]] 
bool empty() const noexcept { 
return _M_pathname.
empty(); }
 
  472    bool has_root_name() const noexcept;
 
  473    bool has_root_directory() const noexcept;
 
  474    bool has_root_path() const noexcept;
 
  475    bool has_relative_path() const noexcept;
 
  476    bool has_parent_path() const noexcept;
 
  477    bool has_filename() const noexcept;
 
  478    bool has_stem() const noexcept;
 
  479    bool has_extension() const noexcept;
 
  480    bool is_absolute() const noexcept;
 
  481    bool is_relative() const noexcept { 
return !is_absolute(); }
 
  484    path lexically_normal() 
const;
 
  485    path lexically_relative(
const path& base) 
const;
 
  486    path lexically_proximate(
const path& base) 
const;
 
  490    using const_iterator = iterator;
 
  492    iterator begin() 
const;
 
  493    iterator end() 
const;
 
  496    template<
typename _CharT, 
typename _Traits>
 
  500        __os << 
std::quoted(__p.string<_CharT, _Traits>());
 
  505    template<
typename _CharT, 
typename _Traits>
 
  519    { 
return path::_S_compare(__lhs, __rhs) == 0; }
 
  521#if __cpp_lib_three_way_comparison 
  523    friend strong_ordering
 
  524    operator<=>(
const path& __lhs, 
const path& __rhs) 
noexcept 
  525    { 
return path::_S_compare(__lhs, __rhs) <=> 0; }
 
  529    { 
return !(__lhs == __rhs); }
 
  533    { 
return __lhs.compare(__rhs) < 0; }
 
  537    { 
return !(__rhs < __lhs); }
 
  541    { 
return __rhs < __lhs; }
 
  545    { 
return !(__lhs < __rhs); }
 
  551      path __result(__lhs);
 
  557    enum class _Type : 
unsigned char {
 
  558      _Multi = 0, _Root_name, _Root_dir, _Filename
 
  563    enum class _Split { _Stem, _Extension };
 
  565    void _M_append(basic_string_view<value_type>);
 
  566    void _M_concat(basic_string_view<value_type>);
 
  568    pair<const string_type*, size_t> _M_find_extension() const noexcept;
 
  579    _S_convert(string_type __str)
 
  582    template<
typename _Tp>
 
  584      _S_convert(
const _Tp& __str)
 
  586        if constexpr (is_same_v<_Tp, string_type>)
 
  588        else if constexpr (is_same_v<_Tp, basic_string_view<value_type>>)
 
  590        else if constexpr (is_same_v<typename _Tp::value_type, value_type>)
 
  591          return basic_string_view<value_type>(__str.data(), __str.size());
 
  593          return _S_convert(__str.data(), __str.data() + __str.size());
 
  596    template<
typename _E
charT>
 
  598      _S_convert(
const _EcharT* __first, 
const _EcharT* __last);
 
  601    _S_convert_loc(
const char* __first, 
const char* __last,
 
  604    template<
typename _Iter>
 
  606      _S_convert_loc(_Iter __first, _Iter __last, 
const std::locale& __loc)
 
  608        const auto __s = __detail::__string_from_range(__first, __last);
 
  609        return _S_convert_loc(__s.data(), __s.data() + __s.size(), __loc);
 
  612    template<
typename _Tp>
 
  614      _S_convert_loc(
const _Tp& __s, 
const std::locale& __loc)
 
  616        return _S_convert_loc(__s.data(), __s.data() + __s.size(), __loc);
 
  619    template<
typename _CharT, 
typename _Traits, 
typename _Allocator>
 
  620      static basic_string<_CharT, _Traits, _Allocator>
 
  621      _S_str_convert(basic_string_view<value_type>, 
const _Allocator&);
 
  624    __attribute__((__always_inline__))
 
  626    _S_compare(
const path& __lhs, 
const path& __rhs) 
noexcept;
 
  628    void _M_split_cmpts();
 
  630    _Type _M_type() const noexcept { 
return _M_cmpts.type(); }
 
  632    string_type _M_pathname;
 
  638      using value_type = _Cmpt;
 
  639      using iterator = value_type*;
 
  640      using const_iterator = 
const value_type*;
 
  644      _List(_List&&) = 
default;
 
  645      _List& operator=(
const _List&);
 
  646      _List& operator=(_List&&) = 
default;
 
  649      _Type type() const noexcept
 
  650      { 
return _Type(
reinterpret_cast<uintptr_t
>(_M_impl.get()) & 0x3); }
 
  652      void type(_Type) 
noexcept;
 
  654      int size() const noexcept; 
 
  655      bool empty() const noexcept; 
 
  657      void swap(_List& __l) noexcept { _M_impl.swap(__l._M_impl); }
 
  658      int capacity() const noexcept;
 
  659      void reserve(
int, 
bool); 
 
  664      iterator begin() noexcept;
 
  665      iterator end() noexcept;
 
  666      const_iterator begin() const noexcept;
 
  667      const_iterator end() const noexcept;
 
  669      value_type& front() noexcept;
 
  670      value_type& back() noexcept;
 
  671      const value_type& front() const noexcept;
 
  672      const value_type& back() const noexcept;
 
  675      void _M_erase_from(const_iterator __pos); 
 
  680        void operator()(_Impl*) 
const noexcept;
 
  682      unique_ptr<_Impl, _Impl_deleter> _M_impl;
 
  692  inline void swap(path& __lhs, path& __rhs) 
noexcept { __lhs.swap(__rhs); }
 
  694  size_t hash_value(
const path& __p) 
noexcept;
 
  718    const path& path1() 
const noexcept;
 
  719    const path& path2() 
const noexcept;
 
  720    const char* 
what() const noexcept;
 
  724    std::__shared_ptr<const _Impl> _M_impl;
 
  730  [[noreturn]] 
inline void 
  731  __throw_conversion_error()
 
  734         "Cannot convert character sequence",
 
  735         std::make_error_code(errc::illegal_byte_sequence)));
 
  738#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
  739  template<
typename _Tp>
 
  741    __wstr_from_utf8(
const _Tp& __str)
 
  743      static_assert(std::is_same_v<typename _Tp::value_type, char>);
 
  746      std::codecvt_utf8_utf16<wchar_t> __wcvt;
 
  747      const auto __p = __str.
data();
 
  748      if (!__str_codecvt_in_all(__p, __p + __str.size(), __wstr, __wcvt))
 
  749        __detail::__throw_conversion_error();
 
  762  template<
typename _InputIterator,
 
  763           typename _Require = __detail::_Path2<_InputIterator>,
 
  765             = __detail::__value_type_is_char_or_char8_t<_InputIterator>>
 
  767    u8path(_InputIterator __first, _InputIterator __last)
 
  769#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
  770      if constexpr (is_same_v<_CharT, char>)
 
  771        return path{ __detail::__wstr_from_utf8(
 
  772            __detail::__string_from_range(__first, __last)) };
 
  774        return path{ __first, __last }; 
 
  777      return path{ __first, __last };
 
  785  template<
typename _Source,
 
  786           typename _Require = __detail::_Path<_Source>,
 
  787           typename _CharT = __detail::__value_type_is_char_or_char8_t<_Source>>
 
  791#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
  792      if constexpr (is_same_v<_CharT, char>)
 
  793        return path{ __detail::__wstr_from_utf8(
 
  794            __detail::__effective_range(__source)) };
 
  796        return path{ __source }; 
 
  799      return path{ __source };
 
  805  struct path::_Cmpt : 
path 
  809    _Cmpt() : _M_pos(-1) { }
 
  814  template<
typename _E
charT>
 
  816    path::_S_convert(
const _EcharT* __f, 
const _EcharT* __l)
 
  818      static_assert(__detail::__is_encoded_char<_EcharT>);
 
  820      if constexpr (is_same_v<_EcharT, value_type>)
 
  821        return basic_string_view<value_type>(__f, __l - __f);
 
  822#if !defined _GLIBCXX_FILESYSTEM_IS_WINDOWS && defined _GLIBCXX_USE_CHAR8_T 
  823      else if constexpr (is_same_v<_EcharT, char8_t>)
 
  825        return string_view(
reinterpret_cast<const char*
>(__f), __l - __f);
 
  829#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
  831          if constexpr (is_same_v<_EcharT, char>)
 
  833              struct _UCvt : 
std::codecvt<wchar_t, char, std::mbstate_t>
 
  835              if (__str_codecvt_in_all(__f, __l, __wstr, __cvt))
 
  838#ifdef _GLIBCXX_USE_CHAR8_T 
  839          else if constexpr (is_same_v<_EcharT, char8_t>)
 
  841              const auto __f2 = 
reinterpret_cast<const char*
>(__f);
 
  842              return __detail::__wstr_from_utf8(string_view(__f2, __l - __f));
 
  847              struct _UCvt : 
std::codecvt<_EcharT, char, std::mbstate_t>
 
  850              if (__str_codecvt_out_all(__f, __l, __str, __cvt))
 
  851                return __detail::__wstr_from_utf8(__str);
 
  854          struct _UCvt : 
std::codecvt<_EcharT, char, std::mbstate_t>
 
  857          if (__str_codecvt_out_all(__f, __l, __str, __cvt))
 
  860          __detail::__throw_conversion_error();
 
  870    using difference_type       = std::ptrdiff_t;
 
  876    iterator() : _M_path(
nullptr), _M_cur(), _M_at_end() { }
 
  885    iterator  operator++(
int) { 
auto __tmp = *
this; ++*
this; 
return __tmp; }
 
  888    iterator  operator--(
int) { 
auto __tmp = *
this; --*
this; 
return __tmp; }
 
  891    { 
return __lhs._M_equals(__rhs); }
 
  894    { 
return !__lhs._M_equals(__rhs); }
 
  899    bool _M_is_multi()
 const { 
return _M_path->_M_type() == _Type::_Multi; }
 
  901    friend difference_type
 
  904      __glibcxx_assert(__first._M_path != 
nullptr);
 
  905      __glibcxx_assert(__first._M_path == __last._M_path);
 
  906      if (__first._M_is_multi())
 
  908      else if (__first._M_at_end == __last._M_at_end)
 
  911        return __first._M_at_end ? -1 : 1;
 
  915    __path_iter_advance(
iterator& __i, difference_type __n)
 
  923          __glibcxx_assert(__i._M_path != 
nullptr);
 
  924          __glibcxx_assert(__i._M_is_multi());
 
  930    iterator(
const path* __path, path::_List::const_iterator __iter)
 
  931    : _M_path(__path), _M_cur(__iter), _M_at_end()
 
  935    : _M_path(__path), _M_cur(), _M_at_end(__at_end)
 
  941    path::_List::const_iterator _M_cur;
 
  947  path::operator=(
path&& __p) 
noexcept 
  949    if (&__p == 
this) [[__unlikely__]]
 
  952    _M_pathname = 
std::move(__p._M_pathname);
 
  959  path::operator=(string_type&& __source)
 
  963  path::assign(string_type&& __source)
 
  964  { 
return *
this = path(
std::move(__source)); }
 
  967  path::operator+=(
const string_type& __x)
 
  974  path::operator+=(
const value_type* __x)
 
  981  path::operator+=(value_type __x)
 
  983    _M_concat(basic_string_view<value_type>(&__x, 1));
 
  988  path::operator+=(basic_string_view<value_type> __x)
 
  994  template<
typename _CharT>
 
  995    inline __detail::_Path2<_CharT*>&
 
  996    path::operator+=(
const _CharT __x)
 
  998      _M_concat(_S_convert(&__x, &__x + 1));
 
 1003  path::make_preferred()
 
 1005#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
 1006    std::replace(_M_pathname.begin(), _M_pathname.end(), L
'/',
 
 1007                 preferred_separator);
 
 1012  inline void path::swap(path& __rhs) 
noexcept 
 1014    _M_pathname.swap(__rhs._M_pathname);
 
 1015    _M_cmpts.swap(__rhs._M_cmpts);
 
 1019  template<
typename _CharT, 
typename _Traits, 
typename _Allocator>
 
 1021    path::_S_str_convert(basic_string_view<value_type> __str,
 
 1022                         const _Allocator& __a)
 
 1024      static_assert(!is_same_v<_CharT, value_type>);
 
 1026      using _WString = basic_string<_CharT, _Traits, _Allocator>;
 
 1028      if (__str.size() == 0)
 
 1029        return _WString(__a);
 
 1031#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
 1034      std::codecvt_utf8_utf16<value_type> __cvt;
 
 1036      using _CharAlloc = __alloc_rebind<_Allocator, char>;
 
 1037      using _String = basic_string<char, char_traits<char>, _CharAlloc>;
 
 1038      _String __u8str{_CharAlloc{__a}};
 
 1039      const value_type* __wfirst = __str.
data();
 
 1040      const value_type* __wlast = __wfirst + __str.size();
 
 1041      if (__str_codecvt_out_all(__wfirst, __wlast, __u8str, __cvt)) {
 
 1042      if constexpr (is_same_v<_CharT, char>)
 
 1046      const char* __first = __u8str.data();
 
 1047      const char* __last = __first + __u8str.size();
 
 1049      const value_type* __first = __str.data();
 
 1050      const value_type* __last = __first + __str.size();
 
 1054#ifdef _GLIBCXX_USE_CHAR8_T 
 1055      if constexpr (is_same_v<_CharT, char8_t>)
 
 1056        return _WString(__first, __last, __a);
 
 1061          _WString __wstr(__a);
 
 1062          struct _UCvt : 
std::codecvt<_CharT, char, std::mbstate_t> { } __cvt;
 
 1063          if (__str_codecvt_in_all(__first, __last, __wstr, __cvt))
 
 1067#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
 1070      __detail::__throw_conversion_error();
 
 1074  template<
typename _CharT, 
typename _Traits, 
typename _Allocator>
 
 1075    inline basic_string<_CharT, _Traits, _Allocator>
 
 1076    path::string(
const _Allocator& __a)
 const 
 1078      if constexpr (is_same_v<_CharT, value_type>)
 
 1079        return { _M_pathname.c_str(), _M_pathname.length(), __a };
 
 1081        return _S_str_convert<_CharT, _Traits>(_M_pathname, __a);
 
 1085  path::string()
 const { 
return string<char>(); }
 
 1087#if _GLIBCXX_USE_WCHAR_T 
 1089  path::wstring()
 const { 
return string<wchar_t>(); }
 
 1092#ifdef _GLIBCXX_USE_CHAR8_T 
 1093  inline std::u8string
 
 1094  path::u8string()
 const { 
return string<char8_t>(); }
 
 1097  path::u8string()
 const 
 1099#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
 1102    std::codecvt_utf8_utf16<value_type> __cvt;
 
 1103    const value_type* __first = _M_pathname.
data();
 
 1104    const value_type* __last = __first + _M_pathname.size();
 
 1105    if (__str_codecvt_out_all(__first, __last, __str, __cvt))
 
 1107    __detail::__throw_conversion_error();
 
 1115  path::u16string()
 const { 
return string<char16_t>(); }
 
 1118  path::u32string()
 const { 
return string<char32_t>(); }
 
 1120  template<
typename _CharT, 
typename _Traits, 
typename _Allocator>
 
 1122    path::generic_string(
const _Allocator& __a)
 const 
 1124#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
 1125      const value_type __slash = L
'/';
 
 1127      const value_type __slash = 
'/';
 
 1129      using _Alloc2 = 
typename allocator_traits<_Allocator>::template
 
 1130        rebind_alloc<value_type>;
 
 1131      basic_string<value_type, char_traits<value_type>, _Alloc2> __str(__a);
 
 1133      if (_M_type() == _Type::_Root_dir)
 
 1134        __str.
assign(1, __slash);
 
 1137          __str.
reserve(_M_pathname.size());
 
 1138          bool __add_slash = 
false;
 
 1139          for (
auto& __elem : *this)
 
 1141#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
 1142              if (__elem._M_type() == _Type::_Root_dir)
 
 1150              __str += basic_string_view<value_type>(__elem._M_pathname);
 
 1151              __add_slash = __elem._M_type() == _Type::_Filename;
 
 1155      if constexpr (is_same_v<_CharT, value_type>)
 
 1158        return _S_str_convert<_CharT, _Traits>(__str, __a);
 
 1162  path::generic_string()
 const 
 1163  { 
return generic_string<char>(); }
 
 1165#if _GLIBCXX_USE_WCHAR_T 
 1167  path::generic_wstring()
 const 
 1168  { 
return generic_string<wchar_t>(); }
 
 1171#ifdef _GLIBCXX_USE_CHAR8_T 
 1172  inline std::u8string
 
 1173  path::generic_u8string()
 const 
 1174  { 
return generic_string<char8_t>(); }
 
 1177  path::generic_u8string()
 const 
 1178  { 
return generic_string(); }
 
 1182  path::generic_u16string()
 const 
 1183  { 
return generic_string<char16_t>(); }
 
 1186  path::generic_u32string()
 const 
 1187  { 
return generic_string<char32_t>(); }
 
 1190  path::compare(
const string_type& __s) 
const noexcept 
 1191  { 
return compare(basic_string_view<value_type>(__s)); }
 
 1194  path::compare(
const value_type* __s) 
const noexcept 
 1195  { 
return compare(basic_string_view<value_type>(__s)); }
 
 1198  path::filename()
 const 
 1202    else if (_M_type() == _Type::_Filename)
 
 1204    else if (_M_type() == _Type::_Multi)
 
 1206        if (_M_pathname.back() == preferred_separator)
 
 1208        auto __last = --
end();
 
 1209        if (__last->_M_type() == _Type::_Filename)
 
 1218    auto ext = _M_find_extension();
 
 1219    if (ext.first && ext.second != 0)
 
 1220      return path{ext.first->substr(0, ext.second)};
 
 1225  path::extension()
 const 
 1227    auto ext = _M_find_extension();
 
 1228    if (ext.first && ext.second != string_type::npos)
 
 1229      return path{ext.first->substr(ext.second)};
 
 1234  path::has_stem() const noexcept
 
 1236    auto ext = _M_find_extension();
 
 1237    return ext.first && ext.second != 0;
 
 1241  path::has_extension() const noexcept
 
 1243    auto ext = _M_find_extension();
 
 1244    return ext.first && ext.second != string_type::npos;
 
 1248  path::is_absolute() const noexcept
 
 1250#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 
 1251    return has_root_name() && has_root_directory();
 
 1253    return has_root_directory();
 
 1257  inline path::iterator
 
 1260    if (_M_type() == _Type::_Multi)
 
 1261      return iterator(
this, _M_cmpts.begin());
 
 1262    return iterator(
this, 
empty());
 
 1265  inline path::iterator
 
 1268    if (_M_type() == _Type::_Multi)
 
 1269      return iterator(
this, _M_cmpts.end());
 
 1270    return iterator(
this, 
true);
 
 1273  inline path::iterator&
 
 1274  path::iterator::operator++()
 
 1276    __glibcxx_assert(_M_path != 
nullptr);
 
 1277    if (_M_path->_M_type() == _Type::_Multi)
 
 1279        __glibcxx_assert(_M_cur != _M_path->_M_cmpts.end());
 
 1284        __glibcxx_assert(!_M_at_end);
 
 1290  inline path::iterator&
 
 1291  path::iterator::operator--()
 
 1293    __glibcxx_assert(_M_path != 
nullptr);
 
 1294    if (_M_path->_M_type() == _Type::_Multi)
 
 1296        __glibcxx_assert(_M_cur != _M_path->_M_cmpts.begin());
 
 1301        __glibcxx_assert(_M_at_end);
 
 1307  inline path::iterator::reference
 
 1308  path::iterator::operator*()
 const 
 1310    __glibcxx_assert(_M_path != 
nullptr);
 
 1311    if (_M_path->_M_type() == _Type::_Multi)
 
 1313        __glibcxx_assert(_M_cur != _M_path->_M_cmpts.end());
 
 1320  path::iterator::_M_equals(iterator __rhs)
 const 
 1322    if (_M_path != __rhs._M_path)
 
 1324    if (_M_path == 
nullptr)
 
 1326    if (_M_path->_M_type() == path::_Type::_Multi)
 
 1327      return _M_cur == __rhs._M_cur;
 
 1328    return _M_at_end == __rhs._M_at_end;
 
 1336  path::_S_compare(
const path& __lhs, 
const path& __rhs) 
noexcept 
 1337  { 
return __lhs.compare(__rhs); }
 
 1340_GLIBCXX_END_NAMESPACE_CXX11
 
 1346distance(filesystem::path::iterator __first, filesystem::path::iterator __last)
 
 1347{ 
return __path_iter_distance(__first, __last); }
 
 1349template<
typename _Distance>
 
 1351  advance(filesystem::path::iterator& __i, _Distance __n)
 
 1352  { __path_iter_advance(__i, 
static_cast<ptrdiff_t
>(__n)); }
 
 1354extern template class __shared_ptr<const filesystem::filesystem_error::_Impl>;
 
 1361  struct hash<filesystem::path>
 
 1364    operator()(
const filesystem::path& __p) 
const noexcept 
 1365    { 
return filesystem::hash_value(__p); }
 
 1368_GLIBCXX_END_NAMESPACE_VERSION
 
path u8path(_InputIterator __first, _InputIterator __last)
 
path u8path(const _Source &__source)
 
typename remove_reference< _Tp >::type remove_reference_t
Alias template for remove_reference.
 
integral_constant< bool, __v > bool_constant
Alias template for compile-time boolean constant types.
 
void void_t
A metafunction that always yields void, used for detecting valid types.
 
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
 
typename enable_if< _Cond, _Tp >::type enable_if_t
Alias template for enable_if.
 
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.
 
_Tp * end(valarray< _Tp > &__va) noexcept
Return an iterator pointing to one past the last element of the valarray.
 
ISO C++ entities toplevel namespace is std.
 
constexpr iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
 
constexpr auto empty(const _Container &__cont) noexcept(noexcept(__cont.empty())) -> decltype(__cont.empty())
Return whether a container is empty.
 
constexpr auto size(const _Container &__cont) noexcept(noexcept(__cont.size())) -> decltype(__cont.size())
Return the size of a container.
 
constexpr void advance(_InputIterator &__i, _Distance __n)
A generalization of pointer arithmetic.
 
auto quoted(const _CharT *__string, _CharT __delim=_CharT('"'), _CharT __escape = _CharT('\\')) 
Manipulator for quoted strings.
 
Template class basic_istream.
 
Template class basic_ostream.
 
A non-owning reference to a string.
 
An exception type that includes an error_code value.
 
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.
 
basic_string & assign(const basic_string &__str)
Set value to contents of another string.
 
bool empty() const noexcept
 
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
 
Primary class template codecvt.
 
Traits class for iterators.
 
friend bool operator!=(const path &__lhs, const path &__rhs) noexcept
Compare paths.
 
friend bool operator<=(const path &__lhs, const path &__rhs) noexcept
Compare paths.
 
friend bool operator>(const path &__lhs, const path &__rhs) noexcept
Compare paths.
 
friend path operator/(const path &__lhs, const path &__rhs)
Append one path to another.
 
format
path::format is ignored in this implementation
 
friend bool operator>=(const path &__lhs, const path &__rhs) noexcept
Compare paths.
 
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, path &__p)
Read a path from a stream.
 
friend bool operator<(const path &__lhs, const path &__rhs) noexcept
Compare paths.
 
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const path &__p)
Write a path to a stream.
 
friend bool operator==(const path &__lhs, const path &__rhs) noexcept
Compare paths.
 
Exception type thrown by the Filesystem library.
 
const char * what() const noexcept
 
An iterator for the components of a path.
 
Container class for localization functionality.
 
Bidirectional iterators support a superset of forward iterator operations.