Hi

libstdc++: [_Hashtable] Optimize destructor

Hashtable destructor do not need to call clear() method that in addition to
destroying all nodes also reset all buckets to nullptr.

libstdc++-v3/ChangeLog:

    * include/bits/hashtable.h (~_Hashtable()): Replace clear call with
    a _M_deallocate_nodes call.

Tested under Linux x64, ok to commit ?

François
diff --git a/libstdc++-v3/include/bits/hashtable.h 
b/libstdc++-v3/include/bits/hashtable.h
index e8e51714d72..45b232111da 100644
--- a/libstdc++-v3/include/bits/hashtable.h
+++ b/libstdc++-v3/include/bits/hashtable.h
@@ -1666,7 +1666,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
                    "Cache the hash code or qualify your functors involved"
                    " in hash code and bucket index computation with noexcept");
 
-      clear();
+      this->_M_deallocate_nodes(_M_begin());
       _M_deallocate_buckets();
     }
 

Reply via email to