From ddf5de5b463d9056ea2cc988feb4141dff5bdd64 Mon Sep 17 00:00:00 2001 From: Mattia Barbon Date: Fri, 4 Jul 2003 21:22:05 +0000 Subject: [PATCH] Applied first part of Roger Gammans' wxHashMap patch: reduce number of value_type() constructor calls. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21656 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/hashmap.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/include/wx/hashmap.h b/include/wx/hashmap.h index 7c629ae631..621bd6c528 100644 --- a/include/wx/hashmap.h +++ b/include/wx/hashmap.h @@ -278,8 +278,11 @@ protected: \ 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; \ \ @@ -290,6 +293,10 @@ protected: \ \ 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 \ -- 2.45.2