previousnext
ASTL homeSTL home

Hash

 

Prototype

template <class DFA> 
unsigned long hash(const DFA &A);

Description

Counts the number of word reconized by A.

Definition

Defined in hash.h.

Requirements on types

Preconditions

Example

CODE
OUTPUT
#include <dfa_matrix.h>
#include <astl_tree.h>
#include <hash.h>

class H_tag
{
public:
unsigned long _H;
H_tag():_H(0)
{}
unsigned long& hash() {return _H;}
};

main()
{
typedef DFA_matrix<Type_alphabet<char>, H_tag > DFA_type;
typedef istream_iterator<vector<typename DFA_type::Alphabet> > Entry;
DFA_type dfa;
cout<<"enter words (return to separe, ctr-D to end)"<<endl;
tree_build(dfa,Entry(cin),Entry());
cout<<"number of words reconized by your DFA"<<endl;
cout<<hash(dfa)<<endl;
}

# ./Hash
enter words (return to separe, ctr-D to end)
ASTL
automaton
stl
template
generic
mice

number of words reconized by your DFA
6

Notes

See also