# HG changeset patch # User klao # Date 1082573786 0 # Node ID 9ca84022df34cd0241c84543b2116a93792ab1e9 # Parent 749a831c6a8f918c3ecbb9dc1521227bbec28597 Masikfele iteralas, Node-hoz alkalmazkodva... diff -r 749a831c6a8f -r 9ca84022df34 src/work/klao/iter_map.h --- a/src/work/klao/iter_map.h Wed Apr 21 17:14:59 2004 +0000 +++ b/src/work/klao/iter_map.h Wed Apr 21 18:56:26 2004 +0000 @@ -10,6 +10,7 @@ // for memset #include +#include namespace hugo { @@ -112,6 +113,33 @@ return bounds[N-1]; } + + /// For use as an iterator... + KeyType& first(KeyType &k, Val n) { + size_t i = (n ? bounds[n-1] : 0); + if( i < bounds[n] ) { + k = data[i]; + } + else { + k = INVALID; + } + return k; + } + + /// For use as an iterator... + KeyType& next(KeyType &k) { + size_t i = base[k]; + uint8_t n = find(i); + ++i; + if( i < bounds[n] ) { + k = data[i]; + } + else { + k = INVALID; + } + return k; + } + }; diff -r 749a831c6a8f -r 9ca84022df34 src/work/klao/iter_map_test.cc --- a/src/work/klao/iter_map_test.cc Wed Apr 21 17:14:59 2004 +0000 +++ b/src/work/klao/iter_map_test.cc Wed Apr 21 18:56:26 2004 +0000 @@ -26,8 +26,6 @@ } } - - int main() { {