Skip to content

Commit

Permalink
The compiler tells me that I need an opApply. Haven't figured out how
Browse files Browse the repository at this point in the history
to write it, though
  • Loading branch information
Eric Hanchrow committed Aug 27, 2009
1 parent b197ce0 commit 05c8831
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion d/dictionary.d
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class dictionary
{ {
return map.length; return map.length;
} }

char[][] lookup (bag b) char[][] lookup (bag b)
{ {
return map[b].keys; return map[b].keys;
Expand All @@ -34,6 +34,17 @@ class dictionary
return map.keys; return map.keys;
} }


int opApply(int delegate(ref char [][]) dg)
{
foreach (char [][] strings; map)
{
result = dg (strings);
if (result)
break;
}
return result;
}

unittest unittest
{ {
printf ("Snarfing a test dictionary; patience! ... \n"); printf ("Snarfing a test dictionary; patience! ... \n");
Expand Down

0 comments on commit 05c8831

Please sign in to comment.