]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/hashmap.h
added wxScopeGuard; test it in the sample
[wxWidgets.git] / include / wx / hashmap.h
index 7c629ae63193ac30e3dff8b2635110e16216e02f..621bd6c5288fa3900a2a40d0b9d686ef05da9b41 100644 (file)
@@ -278,8 +278,11 @@ protected: \
                 return node; \
             node = node->m_next(); \
         } \
                 return node; \
             node = node->m_next(); \
         } \
- \
-        node = new Node( value ); \
+       return CreateNode( value  , bucket); \
+    }\
+    Node * CreateNode( const value_type& value, size_t bucket ) \
+    {\
+        Node* node = new Node( value ); \
         node->m_nxt = m_table[bucket]; \
         m_table[bucket] = node; \
  \
         node->m_nxt = m_table[bucket]; \
         m_table[bucket] = node; \
  \
@@ -290,6 +293,10 @@ protected: \
  \
         return node; \
     } \
  \
         return node; \
     } \
+    void CreateNode( const value_type& value ) \
+    {\
+        CreateNode(value, m_hasher( m_getKey(value) ) % m_tableBuckets ); \
+    }\
  \
     /* returns NULL if not found */ \
     Node** GetNodePtr( const const_key_type& key ) const \
  \
     /* returns NULL if not found */ \
     Node** GetNodePtr( const const_key_type& key ) const \