Przeglądaj źródła

fix(rbtree): rbtree copy

greatbridf 1 rok temu
rodzic
commit
20ed412b5a
2 zmienionych plików z 4 dodań i 4 usunięć
  1. 2 2
      gblibstdc++/include/bits/rbtree
  2. 2 2
      gblibstdc++/include/map

+ 2 - 2
gblibstdc++/include/bits/rbtree

@@ -316,11 +316,11 @@ public:
 
         newnd->left = copy(nd->left);
         if (newnd->left)
-            newnd->left->parent = newnd->left;
+            newnd->left->parent = newnd;
 
         newnd->right = copy(nd->right);
         if (newnd->right)
-            newnd->right->parent = newnd->right;
+            newnd->right->parent = newnd;
 
         return newnd;
     }

+ 2 - 2
gblibstdc++/include/map

@@ -101,10 +101,10 @@ public:
         : map(first, last, Compare(), alloc) {}
 
     __GBLIBCPP_CONSTEXPR
-    map(const map& other) : tree(other) {}
+    map(const map& other) : tree(other.tree) {}
     __GBLIBCPP_CONSTEXPR
     map(const map& other, const Allocator& alloc)
-        : tree(other, alloc) { }
+        : tree(other.tree, alloc) { }
 
     __GBLIBCPP_CONSTEXPR
     map(map&& other) : tree(std::move(other.tree)) {}