aboutsummaryrefslogtreecommitdiff
path: root/src/hash.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/hash.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/hash.h b/src/hash.h
index c65b20d..10db03a 100644
--- a/src/hash.h
+++ b/src/hash.h
@@ -160,13 +160,53 @@ public:
160 aKeys = ka.allocate( nCapacity ); 160 aKeys = ka.allocate( nCapacity );
161 aValues = va.allocate( nCapacity ); 161 aValues = va.allocate( nCapacity );
162 162
163 for( uint32_t j = 0; j < src.nCapacity; j++ )
164 {
165 if( src.isFilled( j ) )
166 {
167 insert( src.aKeys[j], src.aValues[j] );
168 }
169 }
170 }
171
172 Hash &operator=( const Hash &src )
173 {
163 for( uint32_t j = 0; j < nCapacity; j++ ) 174 for( uint32_t j = 0; j < nCapacity; j++ )
164 { 175 {
176 if( isFilled( j ) )
177 if( !isDeleted( j ) )
178 {
179 va.destroy( &aValues[j] );
180 ka.destroy( &aKeys[j] );
181 }
182 }
183 va.deallocate( aValues, nCapacity );
184 ka.deallocate( aKeys, nCapacity );
185 ca.deallocate( bFilled, nKeysSize );
186 ca.deallocate( bDeleted, nKeysSize );
187 ca.deallocate( aHashCodes, nCapacity );
188
189 nFilled = 0;
190 nDeleted = 0;
191 nCapacity = src.nCapacity;
192 nKeysSize = bitsToBytes( nCapacity );
193 bFilled = ca.allocate( nKeysSize );
194 bDeleted = ca.allocate( nKeysSize );
195 clearBits();
196
197 aHashCodes = ca.allocate( nCapacity );
198 aKeys = ka.allocate( nCapacity );
199 aValues = va.allocate( nCapacity );
200
201 for( uint32_t j = 0; j < src.nCapacity; j++ )
202 {
165 if( src.isFilled( j ) ) 203 if( src.isFilled( j ) )
166 { 204 {
167 insert( src.aKeys[j], src.aValues[j] ); 205 insert( src.aKeys[j], src.aValues[j] );
168 } 206 }
169 } 207 }
208
209 return *this;
170 } 210 }
171 211
172 virtual ~Hash() 212 virtual ~Hash()