[Lemon-commits] [lemon_svn] klao: r493 - hugo/trunk/src/work/klao

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:39:44 CET 2006


Author: klao
Date: Wed Apr 21 20:56:26 2004
New Revision: 493

Modified:
   hugo/trunk/src/work/klao/iter_map.h
   hugo/trunk/src/work/klao/iter_map_test.cc

Log:
Masikfele iteralas, Node-hoz alkalmazkodva...


Modified: hugo/trunk/src/work/klao/iter_map.h
==============================================================================
--- hugo/trunk/src/work/klao/iter_map.h	(original)
+++ hugo/trunk/src/work/klao/iter_map.h	Wed Apr 21 20:56:26 2004
@@ -10,6 +10,7 @@
 // for memset
 #include <cstring>
 
+#include <invalid.h>
 
 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;
+    }
+
   };
 
 

Modified: hugo/trunk/src/work/klao/iter_map_test.cc
==============================================================================
--- hugo/trunk/src/work/klao/iter_map_test.cc	(original)
+++ hugo/trunk/src/work/klao/iter_map_test.cc	Wed Apr 21 20:56:26 2004
@@ -26,8 +26,6 @@
   }
 }
 
-
-
 int main() {
 
   {



More information about the Lemon-commits mailing list