\manpage {\_dictionary} {K,I,impl} {Dictionaries with Implementation Parameter} 
 
\definition
An instance of type \name\ is a dictionary implemented by data type $impl$.
$impl$ must be one of the dictionary implementations listed in
section \ref{Implementations Dictionaries} or a user defined data structure
fulfilling the specification given in section \ref{User Implementations
Dictionaries}. Note that depending on the actual implementation $impl$
the key type $K$ must either be linearly ordered or hashed.

 

{\bf Example}\\
Using a dictionary implemented by skiplists to count the number of 
occurrences of the elements in a sequence of strings.
\begingroup
\ttbig
{\obeyspaces\gdef {\ }}
\ttverbatim

#include <LEDA/_dictionary.h>
#include <LEDA/impl/skiplist.h>

main()
{
  _dictionary<string,int,skiplist> D;
  string s;
  dic_item it;

  while (cin >> s)
  { it = D.lookup(s);
    if (it==nil) D.insert(s,1);
    else D.change_inf(it,D.inf(it)+1);
  }

  forall_items(it,D) cout << D.key(it) << " : " <<  D.inf(it) << endl;

}
\endgroup

 
