Masikfele iteralas, Node-hoz alkalmazkodva...
1.1 --- a/src/work/klao/iter_map.h Wed Apr 21 17:14:59 2004 +0000
1.2 +++ b/src/work/klao/iter_map.h Wed Apr 21 18:56:26 2004 +0000
1.3 @@ -10,6 +10,7 @@
1.4 // for memset
1.5 #include <cstring>
1.6
1.7 +#include <invalid.h>
1.8
1.9 namespace hugo {
1.10
1.11 @@ -112,6 +113,33 @@
1.12 return bounds[N-1];
1.13 }
1.14
1.15 +
1.16 + /// For use as an iterator...
1.17 + KeyType& first(KeyType &k, Val n) {
1.18 + size_t i = (n ? bounds[n-1] : 0);
1.19 + if( i < bounds[n] ) {
1.20 + k = data[i];
1.21 + }
1.22 + else {
1.23 + k = INVALID;
1.24 + }
1.25 + return k;
1.26 + }
1.27 +
1.28 + /// For use as an iterator...
1.29 + KeyType& next(KeyType &k) {
1.30 + size_t i = base[k];
1.31 + uint8_t n = find(i);
1.32 + ++i;
1.33 + if( i < bounds[n] ) {
1.34 + k = data[i];
1.35 + }
1.36 + else {
1.37 + k = INVALID;
1.38 + }
1.39 + return k;
1.40 + }
1.41 +
1.42 };
1.43
1.44
2.1 --- a/src/work/klao/iter_map_test.cc Wed Apr 21 17:14:59 2004 +0000
2.2 +++ b/src/work/klao/iter_map_test.cc Wed Apr 21 18:56:26 2004 +0000
2.3 @@ -26,8 +26,6 @@
2.4 }
2.5 }
2.6
2.7 -
2.8 -
2.9 int main() {
2.10
2.11 {