libstdc++
bits/fs_path.h
Go to the documentation of this file.
1 // Class filesystem::path -*- C++ -*-
2 
3 // Copyright (C) 2014-2021 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
9 // any later version.
10 
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
19 
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
24 
25 /** @file include/bits/fs_path.h
26  * This is an internal header file, included by other library headers.
27  * Do not attempt to use it directly. @headername{filesystem}
28  */
29 
30 #ifndef _GLIBCXX_FS_PATH_H
31 #define _GLIBCXX_FS_PATH_H 1
32 
33 #if __cplusplus >= 201703L
34 
35 #include <utility>
36 #include <type_traits>
37 #include <locale>
38 #include <iosfwd>
39 #include <iomanip>
40 #include <codecvt>
41 #include <string_view>
42 #include <system_error>
43 #include <bits/stl_algobase.h>
44 #include <bits/locale_conv.h>
45 #include <ext/concurrence.h>
46 #include <bits/shared_ptr.h>
47 #include <bits/unique_ptr.h>
48 
49 #if __cplusplus > 201703L
50 # include <compare>
51 #endif
52 
53 #if defined(_WIN32) && !defined(__CYGWIN__)
54 # define _GLIBCXX_FILESYSTEM_IS_WINDOWS 1
55 # include <algorithm>
56 #endif
57 
58 namespace std _GLIBCXX_VISIBILITY(default)
59 {
60 _GLIBCXX_BEGIN_NAMESPACE_VERSION
61 
62 namespace filesystem
63 {
64 _GLIBCXX_BEGIN_NAMESPACE_CXX11
65 
66  /** @addtogroup filesystem
67  * @{
68  */
69 
70  class path;
71 
72  /// @cond undocumented
73 namespace __detail
74 {
75  template<typename _CharT>
76  inline constexpr bool __is_encoded_char = false;
77  template<>
78  inline constexpr bool __is_encoded_char<char> = true;
79 #ifdef _GLIBCXX_USE_CHAR8_T
80  template<>
81  inline constexpr bool __is_encoded_char<char8_t> = true;
82 #endif
83 #if _GLIBCXX_USE_WCHAR_T
84  template<>
85  inline constexpr bool __is_encoded_char<wchar_t> = true;
86 #endif
87  template<>
88  inline constexpr bool __is_encoded_char<char16_t> = true;
89  template<>
90  inline constexpr bool __is_encoded_char<char32_t> = true;
91 
92 #if __cpp_concepts >= 201907L
93  template<typename _Iter>
94  using __safe_iterator_traits = std::iterator_traits<_Iter>;
95 #else
96  template<typename _Iter>
97  struct __safe_iterator_traits : std::iterator_traits<_Iter>
98  { };
99 
100  // Protect against ill-formed iterator_traits specializations in C++17
101  template<> struct __safe_iterator_traits<void*> { };
102  template<> struct __safe_iterator_traits<const void*> { };
103  template<> struct __safe_iterator_traits<volatile void*> { };
104  template<> struct __safe_iterator_traits<const volatile void*> { };
105 #endif
106 
107  template<typename _Iter_traits, typename = void>
108  struct __is_path_iter_src
109  : false_type
110  { };
111 
112  template<typename _Iter_traits>
113  struct __is_path_iter_src<_Iter_traits,
114  void_t<typename _Iter_traits::value_type>>
115  : bool_constant<__is_encoded_char<typename _Iter_traits::value_type>>
116  { };
117 
118  template<typename _Source>
119  inline constexpr bool __is_path_src
120  = __is_path_iter_src<iterator_traits<decay_t<_Source>>>::value;
121 
122  template<>
123  inline constexpr bool __is_path_src<path> = false;
124 
125  template<>
126  inline constexpr bool __is_path_src<volatile path> = false;
127 
128  template<>
129  inline constexpr bool __is_path_src<void*> = false;
130 
131  template<>
132  inline constexpr bool __is_path_src<const void*> = false;
133 
134  template<>
135  inline constexpr bool __is_path_src<volatile void*> = false;
136 
137  template<>
138  inline constexpr bool __is_path_src<const volatile void*> = false;
139 
140  template<typename _CharT, typename _Traits, typename _Alloc>
141  inline constexpr bool
142  __is_path_src<basic_string<_CharT, _Traits, _Alloc>>
143  = __is_encoded_char<_CharT>;
144 
145  template<typename _CharT, typename _Traits>
146  inline constexpr bool
147  __is_path_src<basic_string_view<_CharT, _Traits>>
148  = __is_encoded_char<_CharT>;
149 
150  // SFINAE constraint for Source parameters as required by [fs.path.req].
151  template<typename _Tp>
152  using _Path = enable_if_t<__is_path_src<_Tp>, path>;
153 
154  // SFINAE constraint for InputIterator parameters as required by [fs.req].
155  template<typename _Iter, typename _Tr = __safe_iterator_traits<_Iter>>
156  using _Path2 = enable_if_t<__is_path_iter_src<_Tr>::value, path>;
157 
158  // The __effective_range overloads convert a Source parameter into
159  // either a basic_string_view or basic_string containing the
160  // effective range of the Source, as defined in [fs.path.req].
161 
162  template<typename _CharT, typename _Traits, typename _Alloc>
163  inline basic_string_view<_CharT, _Traits>
164  __effective_range(const basic_string<_CharT, _Traits, _Alloc>& __source)
165  { return __source; }
166 
167  template<typename _CharT, typename _Traits>
168  inline const basic_string_view<_CharT, _Traits>&
169  __effective_range(const basic_string_view<_CharT, _Traits>& __source)
170  { return __source; }
171 
172  template<typename _Source>
173  inline auto
174  __effective_range(const _Source& __source)
175  {
176  if constexpr (is_pointer_v<decay_t<_Source>>)
177  return basic_string_view{&*__source};
178  else
179  {
180  // _Source is an input iterator that iterates over an NTCTS.
181  // Create a basic_string by reading until the null character.
182  using value_type
183  = typename iterator_traits<_Source>::value_type;
184  basic_string<value_type> __str;
185  _Source __it = __source;
186  for (value_type __ch = *__it; __ch != value_type(); __ch = *++__it)
187  __str.push_back(__ch);
188  return __str;
189  }
190  }
191 
192  // The value type of a Source parameter's effective range.
193  template<typename _Tp>
194  using __value_t = typename remove_reference_t<
195  decltype(__detail::__effective_range(std::declval<_Tp>()))>::value_type;
196 
197  // SFINAE helper to check that an effective range has value_type char,
198  // as required by path constructors taking a std::locale parameter.
199  // The type _Tp must have already been checked by _Path<Tp> or _Path2<_Tp>.
200  template<typename _Tp, typename _Val = __value_t<_Tp>>
201  using __value_type_is_char
203 
204  // As above, but also allows char8_t, as required by u8path
205  // C++20 [depr.fs.path.factory]
206  template<typename _Tp, typename _Val = __value_t<_Tp>>
207  using __value_type_is_char_or_char8_t
209 #ifdef _GLIBCXX_USE_CHAR8_T
210  || std::is_same_v<_Val, char8_t>
211 #endif
212  , _Val>;
213 
214  // Create a string or string view from an iterator range.
215  template<typename _InputIterator>
216  inline auto
217  __string_from_range(_InputIterator __first, _InputIterator __last)
218  {
219  using _EcharT
221  static_assert(__is_encoded_char<_EcharT>);
222 
223 #if __cpp_lib_concepts
224  constexpr bool __contiguous = std::contiguous_iterator<_InputIterator>;
225 #else
226  constexpr bool __contiguous
227  = is_pointer_v<decltype(std::__niter_base(__first))>;
228 #endif
229  if constexpr (__contiguous)
230  {
231  // For contiguous iterators we can just return a string view.
232  const auto* __f = std::__to_address(std::__niter_base(__first));
233  const auto* __l = std::__to_address(std::__niter_base(__last));
234  return basic_string_view<_EcharT>(__f, __l - __f);
235  }
236  else
237  // Conversion requires contiguous characters, so create a string.
238  return basic_string<_EcharT>(__first, __last);
239  }
240 
241 } // namespace __detail
242  /// @endcond
243 
244  /// A filesystem path.
245  class path
246  {
247  public:
248 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
249  using value_type = wchar_t;
250  static constexpr value_type preferred_separator = L'\\';
251 #else
252 # ifdef _GLIBCXX_DOXYGEN
253  /// Windows uses wchar_t for path::value_type, POSIX uses char.
254  using value_type = __os_dependent__;
255 # else
256  using value_type = char;
257 # endif
258  static constexpr value_type preferred_separator = '/';
259 #endif
261 
262  /// path::format is ignored in this implementation
263  enum format : unsigned char { native_format, generic_format, auto_format };
264 
265  // constructors and destructor
266 
267  path() noexcept { }
268 
269  path(const path& __p) = default;
270 
271  path(path&& __p)
272 #if _GLIBCXX_USE_CXX11_ABI || _GLIBCXX_FULLY_DYNAMIC_STRING == 0
273  noexcept
274 #endif
275  : _M_pathname(std::move(__p._M_pathname)),
276  _M_cmpts(std::move(__p._M_cmpts))
277  { __p.clear(); }
278 
279  path(string_type&& __source, format = auto_format)
280  : _M_pathname(std::move(__source))
281  { _M_split_cmpts(); }
282 
283  template<typename _Source,
284  typename _Require = __detail::_Path<_Source>>
285  path(_Source const& __source, format = auto_format)
286  : _M_pathname(_S_convert(__detail::__effective_range(__source)))
287  { _M_split_cmpts(); }
288 
289  template<typename _InputIterator,
290  typename _Require = __detail::_Path2<_InputIterator>>
291  path(_InputIterator __first, _InputIterator __last, format = auto_format)
292  : _M_pathname(_S_convert(__first, __last))
293  { _M_split_cmpts(); }
294 
295  template<typename _Source,
296  typename _Require = __detail::_Path<_Source>,
297  typename _Require2 = __detail::__value_type_is_char<_Source>>
298  path(_Source const& __src, const locale& __loc, format = auto_format)
299  : _M_pathname(_S_convert_loc(__detail::__effective_range(__src), __loc))
300  { _M_split_cmpts(); }
301 
302  template<typename _InputIterator,
303  typename _Require = __detail::_Path2<_InputIterator>,
304  typename _Req2 = __detail::__value_type_is_char<_InputIterator>>
305  path(_InputIterator __first, _InputIterator __last, const locale& __loc,
306  format = auto_format)
307  : _M_pathname(_S_convert_loc(__first, __last, __loc))
308  { _M_split_cmpts(); }
309 
310  ~path() = default;
311 
312  // assignments
313 
314  path& operator=(const path&);
315  path& operator=(path&&) noexcept;
316  path& operator=(string_type&& __source);
317  path& assign(string_type&& __source);
318 
319  template<typename _Source>
320  __detail::_Path<_Source>&
321  operator=(_Source const& __source)
322  { return *this = path(__source); }
323 
324  template<typename _Source>
325  __detail::_Path<_Source>&
326  assign(_Source const& __source)
327  { return *this = path(__source); }
328 
329  template<typename _InputIterator>
330  __detail::_Path2<_InputIterator>&
331  assign(_InputIterator __first, _InputIterator __last)
332  { return *this = path(__first, __last); }
333 
334  // appends
335 
336  path& operator/=(const path& __p);
337 
338  template<typename _Source>
339  __detail::_Path<_Source>&
340  operator/=(_Source const& __source)
341  {
342  _M_append(_S_convert(__detail::__effective_range(__source)));
343  return *this;
344  }
345 
346  template<typename _Source>
347  __detail::_Path<_Source>&
348  append(_Source const& __source)
349  {
350  _M_append(_S_convert(__detail::__effective_range(__source)));
351  return *this;
352  }
353 
354  template<typename _InputIterator>
355  __detail::_Path2<_InputIterator>&
356  append(_InputIterator __first, _InputIterator __last)
357  {
358  _M_append(_S_convert(__first, __last));
359  return *this;
360  }
361 
362  // concatenation
363 
364  path& operator+=(const path& __x);
365  path& operator+=(const string_type& __x);
366  path& operator+=(const value_type* __x);
367  path& operator+=(value_type __x);
368  path& operator+=(basic_string_view<value_type> __x);
369 
370  template<typename _Source>
371  __detail::_Path<_Source>&
372  operator+=(_Source const& __x) { return concat(__x); }
373 
374  template<typename _CharT>
375  __detail::_Path2<_CharT*>&
376  operator+=(_CharT __x);
377 
378  template<typename _Source>
379  __detail::_Path<_Source>&
380  concat(_Source const& __x)
381  {
382  _M_concat(_S_convert(__detail::__effective_range(__x)));
383  return *this;
384  }
385 
386  template<typename _InputIterator>
387  __detail::_Path2<_InputIterator>&
388  concat(_InputIterator __first, _InputIterator __last)
389  {
390  _M_concat(_S_convert(__first, __last));
391  return *this;
392  }
393 
394  // modifiers
395 
396  void clear() noexcept { _M_pathname.clear(); _M_split_cmpts(); }
397 
398  path& make_preferred();
399  path& remove_filename();
400  path& replace_filename(const path& __replacement);
401  path& replace_extension(const path& __replacement = path());
402 
403  void swap(path& __rhs) noexcept;
404 
405  // native format observers
406 
407  const string_type& native() const noexcept { return _M_pathname; }
408  const value_type* c_str() const noexcept { return _M_pathname.c_str(); }
409  operator string_type() const { return _M_pathname; }
410 
411  template<typename _CharT, typename _Traits = std::char_traits<_CharT>,
412  typename _Allocator = std::allocator<_CharT>>
414  string(const _Allocator& __a = _Allocator()) const;
415 
416  std::string string() const;
417 #if _GLIBCXX_USE_WCHAR_T
418  std::wstring wstring() const;
419 #endif
420 #ifdef _GLIBCXX_USE_CHAR8_T
421  __attribute__((__abi_tag__("__u8")))
422  std::u8string u8string() const;
423 #else
424  std::string u8string() const;
425 #endif // _GLIBCXX_USE_CHAR8_T
426  std::u16string u16string() const;
427  std::u32string u32string() const;
428 
429  // generic format observers
430  template<typename _CharT, typename _Traits = std::char_traits<_CharT>,
431  typename _Allocator = std::allocator<_CharT>>
433  generic_string(const _Allocator& __a = _Allocator()) const;
434 
435  std::string generic_string() const;
436 #if _GLIBCXX_USE_WCHAR_T
437  std::wstring generic_wstring() const;
438 #endif
439 #ifdef _GLIBCXX_USE_CHAR8_T
440  __attribute__((__abi_tag__("__u8")))
441  std::u8string generic_u8string() const;
442 #else
443  std::string generic_u8string() const;
444 #endif // _GLIBCXX_USE_CHAR8_T
445  std::u16string generic_u16string() const;
446  std::u32string generic_u32string() const;
447 
448  // compare
449 
450  int compare(const path& __p) const noexcept;
451  int compare(const string_type& __s) const noexcept;
452  int compare(const value_type* __s) const noexcept;
453  int compare(basic_string_view<value_type> __s) const noexcept;
454 
455  // decomposition
456 
457  path root_name() const;
458  path root_directory() const;
459  path root_path() const;
460  path relative_path() const;
461  path parent_path() const;
462  path filename() const;
463  path stem() const;
464  path extension() const;
465 
466  // query
467 
468  [[nodiscard]] bool empty() const noexcept { return _M_pathname.empty(); }
469  bool has_root_name() const noexcept;
470  bool has_root_directory() const noexcept;
471  bool has_root_path() const noexcept;
472  bool has_relative_path() const noexcept;
473  bool has_parent_path() const noexcept;
474  bool has_filename() const noexcept;
475  bool has_stem() const noexcept;
476  bool has_extension() const noexcept;
477  bool is_absolute() const noexcept;
478  bool is_relative() const noexcept { return !is_absolute(); }
479 
480  // generation
481  path lexically_normal() const;
482  path lexically_relative(const path& base) const;
483  path lexically_proximate(const path& base) const;
484 
485  // iterators
486  class iterator;
487  using const_iterator = iterator;
488 
489  iterator begin() const;
490  iterator end() const;
491 
492  /// Write a path to a stream
493  template<typename _CharT, typename _Traits>
496  {
497  __os << std::quoted(__p.string<_CharT, _Traits>());
498  return __os;
499  }
500 
501  /// Read a path from a stream
502  template<typename _CharT, typename _Traits>
505  {
507  if (__is >> std::quoted(__tmp))
508  __p = std::move(__tmp);
509  return __is;
510  }
511 
512  // non-member operators
513 
514  /// Compare paths
515  friend bool operator==(const path& __lhs, const path& __rhs) noexcept
516  { return __lhs.compare(__rhs) == 0; }
517 
518 #if __cpp_lib_three_way_comparison
519  /// Compare paths
520  friend strong_ordering
521  operator<=>(const path& __lhs, const path& __rhs) noexcept
522  { return __lhs.compare(__rhs) <=> 0; }
523 #else
524  /// Compare paths
525  friend bool operator!=(const path& __lhs, const path& __rhs) noexcept
526  { return !(__lhs == __rhs); }
527 
528  /// Compare paths
529  friend bool operator<(const path& __lhs, const path& __rhs) noexcept
530  { return __lhs.compare(__rhs) < 0; }
531 
532  /// Compare paths
533  friend bool operator<=(const path& __lhs, const path& __rhs) noexcept
534  { return !(__rhs < __lhs); }
535 
536  /// Compare paths
537  friend bool operator>(const path& __lhs, const path& __rhs) noexcept
538  { return __rhs < __lhs; }
539 
540  /// Compare paths
541  friend bool operator>=(const path& __lhs, const path& __rhs) noexcept
542  { return !(__lhs < __rhs); }
543 #endif
544 
545  /// Append one path to another
546  friend path operator/(const path& __lhs, const path& __rhs)
547  {
548  path __result(__lhs);
549  __result /= __rhs;
550  return __result;
551  }
552 
553  private:
554  enum class _Type : unsigned char {
555  _Multi = 0, _Root_name, _Root_dir, _Filename
556  };
557 
558  path(basic_string_view<value_type> __str, _Type __type)
559  : _M_pathname(__str)
560  {
561  __glibcxx_assert(__type != _Type::_Multi);
562  _M_cmpts.type(__type);
563  }
564 
565  enum class _Split { _Stem, _Extension };
566 
567  void _M_append(basic_string_view<value_type>);
568  void _M_concat(basic_string_view<value_type>);
569 
570  pair<const string_type*, size_t> _M_find_extension() const noexcept;
571 
572  // path::_S_convert creates a basic_string<value_type> or
573  // basic_string_view<value_type> from a range (either the effective
574  // range of a Source parameter, or a pair of InputIterator parameters),
575  // performing the conversions required by [fs.path.type.cvt].
576  // If the value_type of the range value type is path::value_type,
577  // no encoding conversion is performed. If the range is contiguous
578  // a string_view
579 
580  static string_type
581  _S_convert(string_type __str)
582  { return __str; }
583 
584  template<typename _Tp>
585  static auto
586  _S_convert(const _Tp& __str)
587  {
588  if constexpr (is_same_v<_Tp, string_type>)
589  return __str;
590  else if constexpr (is_same_v<_Tp, basic_string_view<value_type>>)
591  return __str;
592  else if constexpr (is_same_v<typename _Tp::value_type, value_type>)
593  return basic_string_view<value_type>(__str.data(), __str.size());
594  else
595  return _S_convert(__str.data(), __str.data() + __str.size());
596  }
597 
598  template<typename _EcharT>
599  static auto
600  _S_convert(const _EcharT* __first, const _EcharT* __last);
601 
602  template<typename _Iter>
603  static auto
604  _S_convert(_Iter __first, _Iter __last)
605  { return _S_convert(__detail::__string_from_range(__first, __last)); }
606 
607  static string_type
608  _S_convert_loc(const char* __first, const char* __last,
609  const std::locale& __loc);
610 
611  template<typename _Iter>
612  static string_type
613  _S_convert_loc(_Iter __first, _Iter __last, const std::locale& __loc)
614  {
615  const auto __s = __detail::__string_from_range(__first, __last);
616  return _S_convert_loc(__s.data(), __s.data() + __s.size(), __loc);
617  }
618 
619  template<typename _Tp>
620  static string_type
621  _S_convert_loc(const _Tp& __s, const std::locale& __loc)
622  {
623  return _S_convert_loc(__s.data(), __s.data() + __s.size(), __loc);
624  }
625 
626  template<typename _CharT, typename _Traits, typename _Allocator>
627  static basic_string<_CharT, _Traits, _Allocator>
628  _S_str_convert(basic_string_view<value_type>, const _Allocator&);
629 
630  void _M_split_cmpts();
631 
632  _Type _M_type() const noexcept { return _M_cmpts.type(); }
633 
634  string_type _M_pathname;
635 
636  struct _Cmpt;
637 
638  struct _List
639  {
640  using value_type = _Cmpt;
641  using iterator = value_type*;
642  using const_iterator = const value_type*;
643 
644  _List();
645  _List(const _List&);
646  _List(_List&&) = default;
647  _List& operator=(const _List&);
648  _List& operator=(_List&&) = default;
649  ~_List() = default;
650 
651  _Type type() const noexcept
652  { return _Type(reinterpret_cast<uintptr_t>(_M_impl.get()) & 0x3); }
653 
654  void type(_Type) noexcept;
655 
656  int size() const noexcept; // zero unless type() == _Type::_Multi
657  bool empty() const noexcept; // true unless type() == _Type::_Multi
658  void clear();
659  void swap(_List& __l) noexcept { _M_impl.swap(__l._M_impl); }
660  int capacity() const noexcept;
661  void reserve(int, bool); ///< @pre type() == _Type::_Multi
662 
663  // All the member functions below here have a precondition !empty()
664  // (and they should only be called from within the library).
665 
666  iterator begin() noexcept;
667  iterator end() noexcept;
668  const_iterator begin() const noexcept;
669  const_iterator end() const noexcept;
670 
671  value_type& front() noexcept;
672  value_type& back() noexcept;
673  const value_type& front() const noexcept;
674  const value_type& back() const noexcept;
675 
676  void pop_back();
677  void _M_erase_from(const_iterator __pos); // erases [__pos,end())
678 
679  struct _Impl;
680  struct _Impl_deleter
681  {
682  void operator()(_Impl*) const noexcept;
683  };
685  };
686  _List _M_cmpts;
687 
688  struct _Parser;
689  };
690 
691  /// @relates std::filesystem::path @{
692 
693  inline void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); }
694 
695  size_t hash_value(const path& __p) noexcept;
696 
697  /// @}
698 
699  /// Exception type thrown by the Filesystem library
701  {
702  public:
703  filesystem_error(const string& __what_arg, error_code __ec);
704 
705  filesystem_error(const string& __what_arg, const path& __p1,
706  error_code __ec);
707 
708  filesystem_error(const string& __what_arg, const path& __p1,
709  const path& __p2, error_code __ec);
710 
711  filesystem_error(const filesystem_error&) = default;
712  filesystem_error& operator=(const filesystem_error&) = default;
713 
714  // No move constructor or assignment operator.
715  // Copy rvalues instead, so that _M_impl is not left empty.
716 
717  ~filesystem_error();
718 
719  const path& path1() const noexcept;
720  const path& path2() const noexcept;
721  const char* what() const noexcept;
722 
723  private:
724  struct _Impl;
725  std::__shared_ptr<const _Impl> _M_impl;
726  };
727 
728  /// @cond undocumented
729 namespace __detail
730 {
731  [[noreturn]] inline void
732  __throw_conversion_error()
733  {
734  _GLIBCXX_THROW_OR_ABORT(filesystem_error(
735  "Cannot convert character sequence",
736  std::make_error_code(errc::illegal_byte_sequence)));
737  }
738 
739 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
740  template<typename _Tp>
741  inline std::wstring
742  __wstr_from_utf8(const _Tp& __str)
743  {
744  static_assert(std::is_same_v<typename _Tp::value_type, char>);
745  std::wstring __wstr;
746  // XXX This assumes native wide encoding is UTF-16.
747  std::codecvt_utf8_utf16<wchar_t> __wcvt;
748  const auto __p = __str.data();
749  if (!__str_codecvt_in_all(__p, __p + __str.size(), __wstr, __wcvt))
750  __detail::__throw_conversion_error();
751  return __wstr;
752  }
753 #endif
754 
755 } // namespace __detail
756  /// @endcond
757 
758 
759  /** Create a path from a UTF-8-encoded sequence of char
760  *
761  * @relates std::filesystem::path
762  */
763  template<typename _InputIterator,
764  typename _Require = __detail::_Path2<_InputIterator>,
765  typename _CharT
766  = __detail::__value_type_is_char_or_char8_t<_InputIterator>>
767  inline path
768  u8path(_InputIterator __first, _InputIterator __last)
769  {
770 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
771  if constexpr (is_same_v<_CharT, char>)
772  return path{ __detail::__wstr_from_utf8(
773  __detail::__string_from_range(__first, __last)) };
774  else
775  return path{ __first, __last }; // constructor handles char8_t
776 #else
777  // This assumes native normal encoding is UTF-8.
778  return path{ __first, __last };
779 #endif
780  }
781 
782  /** Create a path from a UTF-8-encoded sequence of char
783  *
784  * @relates std::filesystem::path
785  */
786  template<typename _Source,
787  typename _Require = __detail::_Path<_Source>,
788  typename _CharT = __detail::__value_type_is_char_or_char8_t<_Source>>
789  inline path
790  u8path(const _Source& __source)
791  {
792 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
793  if constexpr (is_same_v<_CharT, char>)
794  return path{ __detail::__wstr_from_utf8(
795  __detail::__effective_range(__source)) };
796  else
797  return path{ __source }; // constructor handles char8_t
798 #else
799  // This assumes native normal encoding is UTF-8.
800  return path{ __source };
801 #endif
802  }
803 
804  /// @cond undocumented
805 
806  struct path::_Cmpt : path
807  {
808  _Cmpt(basic_string_view<value_type> __s, _Type __t, size_t __pos)
809  : path(__s, __t), _M_pos(__pos) { }
810 
811  _Cmpt() : _M_pos(-1) { }
812 
813  size_t _M_pos;
814  };
815 
816  template<typename _EcharT>
817  auto
818  path::_S_convert(const _EcharT* __f, const _EcharT* __l)
819  {
820  static_assert(__detail::__is_encoded_char<_EcharT>);
821 
822  if constexpr (is_same_v<_EcharT, value_type>)
823  return basic_string_view<value_type>(__f, __l - __f);
824 #if !defined _GLIBCXX_FILESYSTEM_IS_WINDOWS && defined _GLIBCXX_USE_CHAR8_T
825  else if constexpr (is_same_v<_EcharT, char8_t>)
826  // For POSIX converting from char8_t to char is also 'noconv'
827  return string_view(reinterpret_cast<const char*>(__f), __l - __f);
828 #endif
829  else
830  {
831 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
832  std::wstring __wstr;
833  if constexpr (is_same_v<_EcharT, char>)
834  {
835  struct _UCvt : std::codecvt<wchar_t, char, std::mbstate_t>
836  { } __cvt;
837  if (__str_codecvt_in_all(__f, __l, __wstr, __cvt))
838  return __wstr;
839  }
840 #ifdef _GLIBCXX_USE_CHAR8_T
841  else if constexpr (is_same_v<_EcharT, char8_t>)
842  {
843  const auto __f2 = reinterpret_cast<const char*>(__f);
844  return __detail::__wstr_from_utf8(string_view(__f2, __l - __f));
845  }
846 #endif
847  else // char16_t or char32_t
848  {
849  struct _UCvt : std::codecvt<_EcharT, char, std::mbstate_t>
850  { } __cvt;
851  std::string __str;
852  if (__str_codecvt_out_all(__f, __l, __str, __cvt))
853  return __detail::__wstr_from_utf8(__str);
854  }
855 #else // ! windows
856  struct _UCvt : std::codecvt<_EcharT, char, std::mbstate_t>
857  { } __cvt;
858  std::string __str;
859  if (__str_codecvt_out_all(__f, __l, __str, __cvt))
860  return __str;
861 #endif
862  __detail::__throw_conversion_error();
863  }
864  }
865 
866  /// @endcond
867 
868  /// An iterator for the components of a path
870  {
871  public:
872  using difference_type = std::ptrdiff_t;
873  using value_type = path;
874  using reference = const path&;
875  using pointer = const path*;
877 
878  iterator() : _M_path(nullptr), _M_cur(), _M_at_end() { }
879 
880  iterator(const iterator&) = default;
881  iterator& operator=(const iterator&) = default;
882 
883  reference operator*() const;
884  pointer operator->() const { return std::__addressof(**this); }
885 
886  iterator& operator++();
887  iterator operator++(int) { auto __tmp = *this; ++*this; return __tmp; }
888 
889  iterator& operator--();
890  iterator operator--(int) { auto __tmp = *this; --*this; return __tmp; }
891 
892  friend bool operator==(const iterator& __lhs, const iterator& __rhs)
893  { return __lhs._M_equals(__rhs); }
894 
895  friend bool operator!=(const iterator& __lhs, const iterator& __rhs)
896  { return !__lhs._M_equals(__rhs); }
897 
898  private:
899  friend class path;
900 
901  bool _M_is_multi() const { return _M_path->_M_type() == _Type::_Multi; }
902 
903  friend difference_type
904  __path_iter_distance(const iterator& __first, const iterator& __last)
905  {
906  __glibcxx_assert(__first._M_path != nullptr);
907  __glibcxx_assert(__first._M_path == __last._M_path);
908  if (__first._M_is_multi())
909  return std::distance(__first._M_cur, __last._M_cur);
910  else if (__first._M_at_end == __last._M_at_end)
911  return 0;
912  else
913  return __first._M_at_end ? -1 : 1;
914  }
915 
916  friend void
917  __path_iter_advance(iterator& __i, difference_type __n)
918  {
919  if (__n == 1)
920  ++__i;
921  else if (__n == -1)
922  --__i;
923  else if (__n != 0)
924  {
925  __glibcxx_assert(__i._M_path != nullptr);
926  __glibcxx_assert(__i._M_is_multi());
927  // __glibcxx_assert(__i._M_path->_M_cmpts.end() - __i._M_cur >= __n);
928  __i._M_cur += __n;
929  }
930  }
931 
932  iterator(const path* __path, path::_List::const_iterator __iter)
933  : _M_path(__path), _M_cur(__iter), _M_at_end()
934  { }
935 
936  iterator(const path* __path, bool __at_end)
937  : _M_path(__path), _M_cur(), _M_at_end(__at_end)
938  { }
939 
940  bool _M_equals(iterator) const;
941 
942  const path* _M_path;
943  path::_List::const_iterator _M_cur;
944  bool _M_at_end; // only used when type != _Multi
945  };
946 
947 
948  inline path&
949  path::operator=(path&& __p) noexcept
950  {
951  if (&__p == this) [[__unlikely__]]
952  return *this;
953 
954  _M_pathname = std::move(__p._M_pathname);
955  _M_cmpts = std::move(__p._M_cmpts);
956  __p.clear();
957  return *this;
958  }
959 
960  inline path&
961  path::operator=(string_type&& __source)
962  { return *this = path(std::move(__source)); }
963 
964  inline path&
965  path::assign(string_type&& __source)
966  { return *this = path(std::move(__source)); }
967 
968  inline path&
969  path::operator+=(const string_type& __x)
970  {
971  _M_concat(__x);
972  return *this;
973  }
974 
975  inline path&
976  path::operator+=(const value_type* __x)
977  {
978  _M_concat(__x);
979  return *this;
980  }
981 
982  inline path&
983  path::operator+=(value_type __x)
984  {
985  _M_concat(basic_string_view<value_type>(&__x, 1));
986  return *this;
987  }
988 
989  inline path&
990  path::operator+=(basic_string_view<value_type> __x)
991  {
992  _M_concat(__x);
993  return *this;
994  }
995 
996  template<typename _CharT>
997  inline __detail::_Path2<_CharT*>&
998  path::operator+=(const _CharT __x)
999  {
1000  _M_concat(_S_convert(&__x, &__x + 1));
1001  return *this;
1002  }
1003 
1004  inline path&
1005  path::make_preferred()
1006  {
1007 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
1008  std::replace(_M_pathname.begin(), _M_pathname.end(), L'/',
1009  preferred_separator);
1010 #endif
1011  return *this;
1012  }
1013 
1014  inline void path::swap(path& __rhs) noexcept
1015  {
1016  _M_pathname.swap(__rhs._M_pathname);
1017  _M_cmpts.swap(__rhs._M_cmpts);
1018  }
1019 
1020  /// @cond undocumented
1021  template<typename _CharT, typename _Traits, typename _Allocator>
1023  path::_S_str_convert(basic_string_view<value_type> __str,
1024  const _Allocator& __a)
1025  {
1026  static_assert(!is_same_v<_CharT, value_type>);
1027 
1028  using _WString = basic_string<_CharT, _Traits, _Allocator>;
1029 
1030  if (__str.size() == 0)
1031  return _WString(__a);
1032 
1033 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
1034  // First convert native string from UTF-16 to to UTF-8.
1035  // XXX This assumes that the execution wide-character set is UTF-16.
1036  std::codecvt_utf8_utf16<value_type> __cvt;
1037 
1038  using _CharAlloc = __alloc_rebind<_Allocator, char>;
1039  using _String = basic_string<char, char_traits<char>, _CharAlloc>;
1040  _String __u8str{_CharAlloc{__a}};
1041  const value_type* __wfirst = __str.data();
1042  const value_type* __wlast = __wfirst + __str.size();
1043  if (__str_codecvt_out_all(__wfirst, __wlast, __u8str, __cvt)) {
1044  if constexpr (is_same_v<_CharT, char>)
1045  return __u8str; // XXX assumes native ordinary encoding is UTF-8.
1046  else {
1047 
1048  const char* __first = __u8str.data();
1049  const char* __last = __first + __u8str.size();
1050 #else
1051  const value_type* __first = __str.data();
1052  const value_type* __last = __first + __str.size();
1053 #endif
1054 
1055  // Convert UTF-8 string to requested format.
1056 #ifdef _GLIBCXX_USE_CHAR8_T
1057  if constexpr (is_same_v<_CharT, char8_t>)
1058  return _WString(__first, __last, __a);
1059  else
1060 #endif
1061  {
1062  // Convert UTF-8 to wide string.
1063  _WString __wstr(__a);
1064  struct _UCvt : std::codecvt<_CharT, char, std::mbstate_t> { } __cvt;
1065  if (__str_codecvt_in_all(__first, __last, __wstr, __cvt))
1066  return __wstr;
1067  }
1068 
1069 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
1070  } }
1071 #endif
1072  __detail::__throw_conversion_error();
1073  }
1074  /// @endcond
1075 
1076  template<typename _CharT, typename _Traits, typename _Allocator>
1077  inline basic_string<_CharT, _Traits, _Allocator>
1078  path::string(const _Allocator& __a) const
1079  {
1080  if constexpr (is_same_v<_CharT, value_type>)
1081  return { _M_pathname.c_str(), _M_pathname.length(), __a };
1082  else
1083  return _S_str_convert<_CharT, _Traits>(_M_pathname, __a);
1084  }
1085 
1086  inline std::string
1087  path::string() const { return string<char>(); }
1088 
1089 #if _GLIBCXX_USE_WCHAR_T
1090  inline std::wstring
1091  path::wstring() const { return string<wchar_t>(); }
1092 #endif
1093 
1094 #ifdef _GLIBCXX_USE_CHAR8_T
1095  inline std::u8string
1096  path::u8string() const { return string<char8_t>(); }
1097 #else
1098  inline std::string
1099  path::u8string() const
1100  {
1101 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
1102  std::string __str;
1103  // convert from native wide encoding (assumed to be UTF-16) to UTF-8
1104  std::codecvt_utf8_utf16<value_type> __cvt;
1105  const value_type* __first = _M_pathname.data();
1106  const value_type* __last = __first + _M_pathname.size();
1107  if (__str_codecvt_out_all(__first, __last, __str, __cvt))
1108  return __str;
1109  __detail::__throw_conversion_error();
1110 #else
1111  return _M_pathname;
1112 #endif
1113  }
1114 #endif // _GLIBCXX_USE_CHAR8_T
1115 
1116  inline std::u16string
1117  path::u16string() const { return string<char16_t>(); }
1118 
1119  inline std::u32string
1120  path::u32string() const { return string<char32_t>(); }
1121 
1122  template<typename _CharT, typename _Traits, typename _Allocator>
1124  path::generic_string(const _Allocator& __a) const
1125  {
1126 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
1127  const value_type __slash = L'/';
1128 #else
1129  const value_type __slash = '/';
1130 #endif
1131  using _Alloc2 = typename allocator_traits<_Allocator>::template
1132  rebind_alloc<value_type>;
1133  basic_string<value_type, char_traits<value_type>, _Alloc2> __str(__a);
1134 
1135  if (_M_type() == _Type::_Root_dir)
1136  __str.assign(1, __slash);
1137  else
1138  {
1139  __str.reserve(_M_pathname.size());
1140  bool __add_slash = false;
1141  for (auto& __elem : *this)
1142  {
1143 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
1144  if (__elem._M_type() == _Type::_Root_dir)
1145  {
1146  __str += __slash;
1147  continue;
1148  }
1149 #endif
1150  if (__add_slash)
1151  __str += __slash;
1152  __str += basic_string_view<value_type>(__elem._M_pathname);
1153  __add_slash = __elem._M_type() == _Type::_Filename;
1154  }
1155  }
1156 
1157  if constexpr (is_same_v<_CharT, value_type>)
1158  return __str;
1159  else
1160  return _S_str_convert<_CharT, _Traits>(__str, __a);
1161  }
1162 
1163  inline std::string
1164  path::generic_string() const
1165  { return generic_string<char>(); }
1166 
1167 #if _GLIBCXX_USE_WCHAR_T
1168  inline std::wstring
1169  path::generic_wstring() const
1170  { return generic_string<wchar_t>(); }
1171 #endif
1172 
1173 #ifdef _GLIBCXX_USE_CHAR8_T
1174  inline std::u8string
1175  path::generic_u8string() const
1176  { return generic_string<char8_t>(); }
1177 #else
1178  inline std::string
1179  path::generic_u8string() const
1180  { return generic_string(); }
1181 #endif
1182 
1183  inline std::u16string
1184  path::generic_u16string() const
1185  { return generic_string<char16_t>(); }
1186 
1187  inline std::u32string
1188  path::generic_u32string() const
1189  { return generic_string<char32_t>(); }
1190 
1191  inline int
1192  path::compare(const string_type& __s) const noexcept
1193  { return compare(basic_string_view<value_type>(__s)); }
1194 
1195  inline int
1196  path::compare(const value_type* __s) const noexcept
1197  { return compare(basic_string_view<value_type>(__s)); }
1198 
1199  inline path
1200  path::filename() const
1201  {
1202  if (empty())
1203  return {};
1204  else if (_M_type() == _Type::_Filename)
1205  return *this;
1206  else if (_M_type() == _Type::_Multi)
1207  {
1208  if (_M_pathname.back() == preferred_separator)
1209  return {};
1210  auto& __last = *--end();
1211  if (__last._M_type() == _Type::_Filename)
1212  return __last;
1213  }
1214  return {};
1215  }
1216 
1217  inline path
1218  path::stem() const
1219  {
1220  auto ext = _M_find_extension();
1221  if (ext.first && ext.second != 0)
1222  return path{ext.first->substr(0, ext.second)};
1223  return {};
1224  }
1225 
1226  inline path
1227  path::extension() const
1228  {
1229  auto ext = _M_find_extension();
1230  if (ext.first && ext.second != string_type::npos)
1231  return path{ext.first->substr(ext.second)};
1232  return {};
1233  }
1234 
1235  inline bool
1236  path::has_stem() const noexcept
1237  {
1238  auto ext = _M_find_extension();
1239  return ext.first && ext.second != 0;
1240  }
1241 
1242  inline bool
1243  path::has_extension() const noexcept
1244  {
1245  auto ext = _M_find_extension();
1246  return ext.first && ext.second != string_type::npos;
1247  }
1248 
1249  inline bool
1250  path::is_absolute() const noexcept
1251  {
1252 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
1253  return has_root_name() && has_root_directory();
1254 #else
1255  return has_root_directory();
1256 #endif
1257  }
1258 
1259  inline path::iterator
1260  path::begin() const
1261  {
1262  if (_M_type() == _Type::_Multi)
1263  return iterator(this, _M_cmpts.begin());
1264  return iterator(this, empty());
1265  }
1266 
1267  inline path::iterator
1268  path::end() const
1269  {
1270  if (_M_type() == _Type::_Multi)
1271  return iterator(this, _M_cmpts.end());
1272  return iterator(this, true);
1273  }
1274 
1275  inline path::iterator&
1276  path::iterator::operator++()
1277  {
1278  __glibcxx_assert(_M_path != nullptr);
1279  if (_M_path->_M_type() == _Type::_Multi)
1280  {
1281  __glibcxx_assert(_M_cur != _M_path->_M_cmpts.end());
1282  ++_M_cur;
1283  }
1284  else
1285  {
1286  __glibcxx_assert(!_M_at_end);
1287  _M_at_end = true;
1288  }
1289  return *this;
1290  }
1291 
1292  inline path::iterator&
1293  path::iterator::operator--()
1294  {
1295  __glibcxx_assert(_M_path != nullptr);
1296  if (_M_path->_M_type() == _Type::_Multi)
1297  {
1298  __glibcxx_assert(_M_cur != _M_path->_M_cmpts.begin());
1299  --_M_cur;
1300  }
1301  else
1302  {
1303  __glibcxx_assert(_M_at_end);
1304  _M_at_end = false;
1305  }
1306  return *this;
1307  }
1308 
1309  inline path::iterator::reference
1310  path::iterator::operator*() const
1311  {
1312  __glibcxx_assert(_M_path != nullptr);
1313  if (_M_path->_M_type() == _Type::_Multi)
1314  {
1315  __glibcxx_assert(_M_cur != _M_path->_M_cmpts.end());
1316  return *_M_cur;
1317  }
1318  return *_M_path;
1319  }
1320 
1321  inline bool
1322  path::iterator::_M_equals(iterator __rhs) const
1323  {
1324  if (_M_path != __rhs._M_path)
1325  return false;
1326  if (_M_path == nullptr)
1327  return true;
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;
1331  }
1332 
1333  // @} group filesystem
1334 _GLIBCXX_END_NAMESPACE_CXX11
1335 } // namespace filesystem
1336 
1337 inline ptrdiff_t
1338 distance(filesystem::path::iterator __first, filesystem::path::iterator __last)
1339 { return __path_iter_distance(__first, __last); }
1340 
1341 template<typename _InputIterator, typename _Distance>
1342  void
1343  advance(filesystem::path::iterator& __i, _Distance __n)
1344  { __path_iter_advance(__i, static_cast<ptrdiff_t>(__n)); }
1345 
1346 extern template class __shared_ptr<const filesystem::filesystem_error::_Impl>;
1347 
1348 _GLIBCXX_END_NAMESPACE_VERSION
1349 } // namespace std
1350 
1351 #endif // C++17
1352 
1353 #endif // _GLIBCXX_FS_PATH_H
auto_ptr & operator=(auto_ptr &__a)
auto_ptr assignment operator.
Definition: auto_ptr.h:47
element_type * operator->() const
Smart pointer dereferencing.
Definition: auto_ptr.h:105
constexpr complex< _Tp > operator*(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x times y.
Definition: complex:392
friend bool operator!=(const path &__lhs, const path &__rhs) noexcept
Compare paths.
Definition: bits/fs_path.h:525
friend bool operator<=(const path &__lhs, const path &__rhs) noexcept
Compare paths.
Definition: bits/fs_path.h:533
path u8path(_InputIterator __first, _InputIterator __last)
Definition: bits/fs_path.h:768
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const path &__p)
Write a path to a stream.
Definition: bits/fs_path.h:495
path u8path(const _Source &__source)
Definition: bits/fs_path.h:790
friend bool operator>(const path &__lhs, const path &__rhs) noexcept
Compare paths.
Definition: bits/fs_path.h:537
friend path operator/(const path &__lhs, const path &__rhs)
Append one path to another.
Definition: bits/fs_path.h:546
format
path::format is ignored in this implementation
Definition: bits/fs_path.h:263
friend bool operator>=(const path &__lhs, const path &__rhs) noexcept
Compare paths.
Definition: bits/fs_path.h:541
friend bool operator<(const path &__lhs, const path &__rhs) noexcept
Compare paths.
Definition: bits/fs_path.h:529
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, path &__p)
Read a path from a stream.
Definition: bits/fs_path.h:504
friend bool operator==(const path &__lhs, const path &__rhs) noexcept
Compare paths.
Definition: bits/fs_path.h:515
const char * what() const noexcept
typename remove_reference< _Tp >::type remove_reference_t
Alias template for remove_reference.
Definition: type_traits:1595
void void_t
A metafunction that always yields void, used for detecting valid types.
Definition: type_traits:2536
typename enable_if< _Cond, _Tp >::type enable_if_t
Alias template for enable_if.
Definition: type_traits:2514
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
Definition: type_traits:78
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
Definition: move.h:49
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
Definition: move.h:101
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
Definition: any:412
_Tp * begin(valarray< _Tp > &__va)
Return an iterator pointing to the first element of the valarray.
Definition: valarray:1214
_Tp * end(valarray< _Tp > &__va)
Return an iterator pointing to one past the last element of the valarray.
Definition: valarray:1234
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.
Definition: range_access.h:263
constexpr auto size(const _Container &__cont) noexcept(noexcept(__cont.size())) -> decltype(__cont.size())
Return the size of a container.
Definition: range_access.h:245
constexpr auto data(_Container &__cont) noexcept(noexcept(__cont.data())) -> decltype(__cont.data())
Return the data pointer of a container.
Definition: range_access.h:290
auto quoted(const _CharT *__string, _CharT __delim=_CharT('"'), _CharT __escape = _CharT('\\'))
Manipulator for quoted strings.
Definition: iomanip:461
Template class basic_istream.
Definition: istream:59
Template class basic_ostream.
Definition: ostream:59
A non-owning reference to a string.
Definition: string_view:100
An exception type that includes an error_code value.
Definition: system_error:431
const _CharT * c_str() const noexcept
Return const pointer to null-terminated 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.
const _CharT * data() const noexcept
Return const pointer to contents.
void clear() noexcept
bool empty() const noexcept
static const size_type npos
Value returned by various member functions when they fail.
Primary class template codecvt.
Definition: codecvt.h:279
Traits class for iterators.
A filesystem path.
Definition: bits/fs_path.h:246
Exception type thrown by the Filesystem library.
Definition: bits/fs_path.h:701
An iterator for the components of a path.
Definition: bits/fs_path.h:870
Container class for localization functionality.
Bidirectional iterators support a superset of forward iterator operations.