18 #ifndef VCSN_MISC_HASH_HXX_
19 # define VCSN_MISC_HASH_HXX_
22 # include <boost/functional/hash/hash.hpp>
23 # include <vaucanson/algebra/implementation/series/rat/hash_visitor.hh>
31 std::size_t hash_label<char>::operator()(
const char c)
const
37 std::size_t hash_label<int>::operator()(
const int c)
const
42 template <
typename U,
typename V>
44 std::size_t hash_label<std::pair<U, V> >::operator()(
const std::pair<U, V>& p)
const
49 ::boost::hash_combine(seed, p.first);
50 ::boost::hash_combine(seed, p.second);
55 template <
typename Word,
typename Weight>
57 hash_label<algebra::polynom<Word, Weight> >::operator() (
const algebra::polynom<Word, Weight>& l)
const
61 for (
typename algebra::polynom<Word, Weight>::const_iterator i = l.begin ();
66 ::boost::hash_combine (seed, i->first);
73 template <
typename Word,
typename LetterT,
typename WeightT>
75 hash_label<algebra::polynom<Word, rat::exp<LetterT, WeightT> > >::operator() (
76 const algebra::polynom<Word, rat::exp<LetterT, WeightT> >& l)
const
81 for (
typename algebra::polynom<Word, rat::exp<LetterT,
82 WeightT> >::const_iterator i = l.begin ();
86 ::boost::hash_combine (seed, hash(i->first));
87 ::boost::hash_combine (seed, i->second);
92 template <
typename Word,
typename Word2,
typename WeightT>
94 hash_label<algebra::polynom<Word, rat::exp<Word2, WeightT> > >::operator() (
95 const rat::exp<Word2, WeightT>& l)
const
97 rat::HashVisitor<Word2, WeightT> visitor;
99 return visitor.hash_value();
103 template <
typename Word,
typename Word2,
typename WeightT>
105 hash_label<algebra::polynom<Word, rat::exp<Word2, WeightT> > >::operator() (
106 const algebra::polynom<Word, rat::exp<Word2, WeightT> >& l)
const
108 std::size_t seed (0);
111 for (
typename algebra::polynom<Word, rat::exp<Word2,
112 WeightT> >::const_iterator i = l.begin ();
116 ::boost::hash_combine (seed, i->first);
117 ::boost::hash_combine (seed, hash(i->second));
122 template <
typename Weight,
typename T,
typename U>
124 hash_label<algebra::polynom<std::pair<T, U>, Weight> >::operator() (
125 const algebra::polynom<std::pair<T, U>, Weight >& l)
const
127 std::size_t seed (0);
129 for (
typename algebra::polynom<std::pair<T, U>, Weight>::const_iterator i = l.begin ();
133 ::boost::hash_combine (seed, i->first.first);
134 ::boost::hash_combine (seed, i->first.second);
135 ::boost::hash_combine (seed, i->second);
140 template <
typename Word,
typename Weight>
142 hash_label<rat::exp<Word, Weight> >::operator() (
const rat::exp<Word, Weight>& l)
const
144 rat::HashVisitor<Word, Weight> visitor;
146 return visitor.hash_value();
149 template <
typename Kind,
typename Type>
151 hash_handler<handler<Kind, Type> >::operator() (
const handler<Kind, Type>& h)
const
153 return ::boost::hash_value (h.value());
158 hash_handler<char>::operator() (
const char c)
const
160 return ::boost::hash_value (c);
166 #endif // ! VCSN_MISC_HASH_HXX_ //