diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-02-08 00:44:10 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-02-08 00:44:10 +0000 |
commit | 366a8063730aa7ae696bcb9cf56eafd13d43dfc0 (patch) | |
tree | 42e3597edfde0c183506ad0d452f045cb7726137 /src/set.h | |
parent | 4f59dec6bad120b72f1bc075715d79bfbe881f7e (diff) | |
download | libbu++-366a8063730aa7ae696bcb9cf56eafd13d43dfc0.tar.gz libbu++-366a8063730aa7ae696bcb9cf56eafd13d43dfc0.tar.bz2 libbu++-366a8063730aa7ae696bcb9cf56eafd13d43dfc0.tar.xz libbu++-366a8063730aa7ae696bcb9cf56eafd13d43dfc0.zip |
So many updates. I recommend using the new FString iterators instead of direct
indexing. It is now many times faster, and requires less overhead. Also,
more stuff iterator related in every class. More on that later.
Diffstat (limited to 'src/set.h')
-rw-r--r-- | src/set.h | 33 |
1 files changed, 29 insertions, 4 deletions
@@ -322,7 +322,7 @@ namespace Bu | |||
322 | /** | 322 | /** |
323 | * Iterator equality comparison operator. Iterators the same? | 323 | * Iterator equality comparison operator. Iterators the same? |
324 | */ | 324 | */ |
325 | bool operator==( const iterator &oth ) | 325 | bool operator==( const iterator &oth ) const |
326 | { | 326 | { |
327 | if( bFinished != oth.bFinished ) | 327 | if( bFinished != oth.bFinished ) |
328 | return false; | 328 | return false; |
@@ -341,7 +341,7 @@ namespace Bu | |||
341 | /** | 341 | /** |
342 | * Iterator not equality comparison operator. Not the same? | 342 | * Iterator not equality comparison operator. Not the same? |
343 | */ | 343 | */ |
344 | bool operator!=( const iterator &oth ) | 344 | bool operator!=( const iterator &oth ) const |
345 | { | 345 | { |
346 | return !(*this == oth ); | 346 | return !(*this == oth ); |
347 | } | 347 | } |
@@ -366,6 +366,21 @@ namespace Bu | |||
366 | { | 366 | { |
367 | return hsh.getKeyAtPos( nPos ); | 367 | return hsh.getKeyAtPos( nPos ); |
368 | } | 368 | } |
369 | |||
370 | const key &operator *() const | ||
371 | { | ||
372 | return hsh.getKeyAtPos( nPos ); | ||
373 | } | ||
374 | |||
375 | bool isValid() const | ||
376 | { | ||
377 | return !bFinished; | ||
378 | } | ||
379 | |||
380 | operator bool() const | ||
381 | { | ||
382 | return !bFinished; | ||
383 | } | ||
369 | } iterator; | 384 | } iterator; |
370 | 385 | ||
371 | /** | 386 | /** |
@@ -420,7 +435,7 @@ namespace Bu | |||
420 | /** | 435 | /** |
421 | * Iterator equality comparison operator. Iterators the same? | 436 | * Iterator equality comparison operator. Iterators the same? |
422 | */ | 437 | */ |
423 | bool operator==( const const_iterator &oth ) | 438 | bool operator==( const const_iterator &oth ) const |
424 | { | 439 | { |
425 | if( bFinished != oth.bFinished ) | 440 | if( bFinished != oth.bFinished ) |
426 | return false; | 441 | return false; |
@@ -439,7 +454,7 @@ namespace Bu | |||
439 | /** | 454 | /** |
440 | * Iterator not equality comparison operator. Not the same? | 455 | * Iterator not equality comparison operator. Not the same? |
441 | */ | 456 | */ |
442 | bool operator!=( const const_iterator &oth ) | 457 | bool operator!=( const const_iterator &oth ) const |
443 | { | 458 | { |
444 | return !(*this == oth ); | 459 | return !(*this == oth ); |
445 | } | 460 | } |
@@ -464,6 +479,16 @@ namespace Bu | |||
464 | { | 479 | { |
465 | return hsh.getKeyAtPos( nPos ); | 480 | return hsh.getKeyAtPos( nPos ); |
466 | } | 481 | } |
482 | |||
483 | bool isValid() const | ||
484 | { | ||
485 | return !bFinished; | ||
486 | } | ||
487 | |||
488 | operator bool() const | ||
489 | { | ||
490 | return !bFinished; | ||
491 | } | ||
467 | } const_iterator; | 492 | } const_iterator; |
468 | 493 | ||
469 | /** | 494 | /** |