Advertisement
fsb4000

patch

Jan 2nd, 2022
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. ---
  2. stl/inc/filesystem | 19 ++++++++++++++-----
  3. 1 file changed, 14 insertions(+), 5 deletions(-)
  4.  
  5. diff --git a/stl/inc/filesystem b/stl/inc/filesystem
  6. index 36a1b772..e5b033f4 100644
  7. --- a/stl/inc/filesystem
  8. +++ b/stl/inc/filesystem
  9. @@ -968,7 +968,10 @@ namespace filesystem {
  10. _Text.push_back(L'.');
  11. }
  12.  
  13. - return operator+=(_Replacement);
  14. + _Text._Orphan_all();
  15. + _Text += _Replacement._Text;
  16. +
  17. + return *this;
  18. }
  19.  
  20. void swap(path& _Rhs) noexcept {
  21. @@ -1398,12 +1401,12 @@ namespace filesystem {
  22. }
  23.  
  24. _NODISCARD friend bool operator==(const path& _Left, const path& _Right) noexcept {
  25. - return _Left.compare(_Right) == 0;
  26. + return _Left._Compare(_Right._Text) == 0;
  27. }
  28.  
  29. #if _HAS_CXX20
  30. _NODISCARD friend strong_ordering operator<=>(const path& _Left, const path& _Right) noexcept {
  31. - return _Left.compare(_Right) <=> 0;
  32. + return _Left._Compare(_Right._Text) <=> 0;
  33. }
  34. #else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv
  35. _NODISCARD friend bool operator!=(const path& _Left, const path& _Right) noexcept {
  36. @@ -1434,6 +1437,7 @@ namespace filesystem {
  37. }
  38.  
  39. private:
  40. + inline int _Compare(const string_type& _Other) const noexcept;
  41. string_type _Text;
  42. };
  43.  
  44. @@ -1736,8 +1740,9 @@ namespace filesystem {
  45. const path& _Elem = *_B_iter;
  46.  
  47. if (_Elem.empty()) { // skip empty element, N4810 29.11.7.5 [fs.path.itr]/4.4
  48. - } else if (_Elem == _Dot) { // skip filename elements that are dot, N4810 29.11.7.4.11 [fs.path.gen]/4.2
  49. - } else if (_Elem == _Dot_dot) {
  50. + } else if (_Elem._Text
  51. + == _Dot) { // skip filename elements that are dot, N4810 29.11.7.4.11 [fs.path.gen]/4.2
  52. + } else if (_Elem._Text == _Dot_dot) {
  53. --_Num;
  54. } else {
  55. ++_Num;
  56. @@ -1787,6 +1792,10 @@ namespace filesystem {
  57. return iterator(_Text.cend(), this);
  58. }
  59.  
  60. + _NODISCARD inline int path::_Compare(const string_type& _Other) const noexcept {
  61. + return _Text.compare(_Other);
  62. + }
  63. +
  64. class filesystem_error : public system_error { // base of all filesystem-error exceptions
  65. public:
  66. filesystem_error(const string& _Message, const error_code _Errcode)
  67. --
  68. 2.32.0.windows.2
  69.  
  70.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement