Permalink
Browse files

The compiler tells me that I need an opApply. Haven't figured out how

to write it, though
  • Loading branch information...
1 parent b197ce0 commit 05c8831de44313252a072f08e115d5ab8ef8d08c Eric Hanchrow committed Aug 27, 2009
Showing with 12 additions and 1 deletion.
  1. +12 −1 d/dictionary.d
View
@@ -24,7 +24,7 @@ class dictionary
{
return map.length;
}
-
+
char[][] lookup (bag b)
{
return map[b].keys;
@@ -34,6 +34,17 @@ class dictionary
return map.keys;
}
+ int opApply(int delegate(ref char [][]) dg)
+ {
+ foreach (char [][] strings; map)
+ {
+ result = dg (strings);
+ if (result)
+ break;
+ }
+ return result;
+ }
+
unittest
{
printf ("Snarfing a test dictionary; patience! ... \n");

0 comments on commit 05c8831

Please sign in to comment.