Sfoglia il codice sorgente

fix(map): fix erase

greatbridf 2 anni fa
parent
commit
734d075ade
1 ha cambiato i file con 5 aggiunte e 3 eliminazioni
  1. 5 3
      include/types/map.hpp

+ 5 - 3
include/types/map.hpp

@@ -386,7 +386,7 @@ public:
             return ret;
         }
 
-        constexpr operator bool(void)
+        explicit constexpr operator bool(void)
         {
             return p;
         }
@@ -575,8 +575,10 @@ private:
                 }
             } else {
                 s->tored();
-                p->toblack();
-                this->_erase(p);
+                if (node::is_black(p))
+                    this->_erase(p);
+                else
+                    p->toblack();
             }
         }
     }