summaryrefslogtreecommitdiff
path: root/decoder/trule.h
diff options
context:
space:
mode:
authorGuest_account Guest_account prguest11 <prguest11@taipan.cs>2011-10-11 16:16:53 +0100
committerGuest_account Guest_account prguest11 <prguest11@taipan.cs>2011-10-11 16:16:53 +0100
commit0af7d663194beddcde420349bbd91430e0b2e423 (patch)
treef79558499f3756757b94267285ccd1418e55b8ea /decoder/trule.h
parent4671d578bd6d97105ac75b02e0144fe0df3abcb0 (diff)
remove implicit conversion-to-double operator from LogVal<T> that caused overflow errors, clean up some pf code
Diffstat (limited to 'decoder/trule.h')
-rw-r--r--decoder/trule.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/decoder/trule.h b/decoder/trule.h
index 4df4ec90..8eb2a059 100644
--- a/decoder/trule.h
+++ b/decoder/trule.h
@@ -5,7 +5,9 @@
#include <vector>
#include <cassert>
#include <iostream>
-#include <boost/shared_ptr.hpp>
+
+#include "boost/shared_ptr.hpp"
+#include "boost/functional/hash.hpp"
#include "sparse_vector.h"
#include "wordid.h"
@@ -162,4 +164,15 @@ class TRule {
bool SanityCheck() const;
};
+inline size_t hash_value(const TRule& r) {
+ size_t h = boost::hash_value(r.e_);
+ boost::hash_combine(h, -r.lhs_);
+ boost::hash_combine(h, boost::hash_value(r.f_));
+ return h;
+}
+
+inline bool operator==(const TRule& a, const TRule& b) {
+ return (a.lhs_ == b.lhs_ && a.e_ == b.e_ && a.f_ == b.f_);
+}
+
#endif