aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/hash.h15
-rw-r--r--src/list.h34
2 files changed, 41 insertions, 8 deletions
diff --git a/src/hash.h b/src/hash.h
index 8c58645..8856860 100644
--- a/src/hash.h
+++ b/src/hash.h
@@ -268,7 +268,7 @@ namespace Bu
268 268
269 for( uint32_t j = 0; j < src.nCapacity; j++ ) 269 for( uint32_t j = 0; j < src.nCapacity; j++ )
270 { 270 {
271 if( src.isFilled( j ) ) 271 if( src.isFilled( j ) && !src.isDeleted( j ) )
272 { 272 {
273 insert( src.aKeys[j], src.aValues[j] ); 273 insert( src.aKeys[j], src.aValues[j] );
274 } 274 }
@@ -283,12 +283,11 @@ namespace Bu
283 { 283 {
284 for( uint32_t j = 0; j < nCapacity; j++ ) 284 for( uint32_t j = 0; j < nCapacity; j++ )
285 { 285 {
286 if( isFilled( j ) ) 286 if( isFilled( j ) && !isDeleted( j ) )
287 if( !isDeleted( j ) ) 287 {
288 { 288 va.destroy( &aValues[j] );
289 va.destroy( &aValues[j] ); 289 ka.destroy( &aKeys[j] );
290 ka.destroy( &aKeys[j] ); 290 }
291 }
292 } 291 }
293 va.deallocate( aValues, nCapacity ); 292 va.deallocate( aValues, nCapacity );
294 ka.deallocate( aKeys, nCapacity ); 293 ka.deallocate( aKeys, nCapacity );
@@ -310,7 +309,7 @@ namespace Bu
310 309
311 for( uint32_t j = 0; j < src.nCapacity; j++ ) 310 for( uint32_t j = 0; j < src.nCapacity; j++ )
312 { 311 {
313 if( src.isFilled( j ) ) 312 if( src.isFilled( j ) && !src.isDeleted( j ) )
314 { 313 {
315 insert( src.aKeys[j], src.aValues[j] ); 314 insert( src.aKeys[j], src.aValues[j] );
316 } 315 }
diff --git a/src/list.h b/src/list.h
index 8c5e94e..d16e606 100644
--- a/src/list.h
+++ b/src/list.h
@@ -82,6 +82,18 @@ namespace Bu
82 return *this; 82 return *this;
83 } 83 }
84 84
85 MyType &operator+=( const value &v )
86 {
87 append( v );
88 return *this;
89 }
90
91 MyType &operator+=( const MyType &src )
92 {
93 append( src );
94 return *this;
95 }
96
85 /** 97 /**
86 * Clear the data from the list. 98 * Clear the data from the list.
87 */ 99 */
@@ -142,6 +154,15 @@ namespace Bu
142 } 154 }
143 } 155 }
144 156
157 void append( const MyType &rSrc )
158 {
159 for( typename MyType::const_iterator i = rSrc.begin();
160 i != rSrc.end(); i++ )
161 {
162 append( *i );
163 }
164 }
165
145 /** 166 /**
146 * Prepend a value to the list. 167 * Prepend a value to the list.
147 *@param v (const value_type &) The value to prepend. 168 *@param v (const value_type &) The value to prepend.
@@ -168,6 +189,19 @@ namespace Bu
168 } 189 }
169 190
170 /** 191 /**
192 * Prepend another list to the front of this one. This will prepend
193 * the rSrc list in reverse order...I may fix that later.
194 */
195 void prepend( const MyType &rSrc )
196 {
197 for( typename MyType::const_iterator i = rSrc.begin();
198 i != rSrc.end(); i++ )
199 {
200 prepend( *i );
201 }
202 }
203
204 /**
171 * Insert a new item in sort order by searching for the first item that 205 * Insert a new item in sort order by searching for the first item that
172 * is larger and inserting this before it, or at the end if none are 206 * is larger and inserting this before it, or at the end if none are
173 * larger. If this is the only function used to insert data in the 207 * larger. If this is the only function used to insert data in the