diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2015-10-18 03:02:38 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2015-10-18 03:02:38 +0300 |
commit | 55698d15bca43c13371f3b12b080685a0e1ac4c2 (patch) | |
tree | 213862625aab9a67da6bd04a526dc8cd165ea635 /moses/Phrase.h | |
parent | b6cc320b72aec8fd035521864c35052182b52851 (diff) |
templatize Comparer for unordered maps/set
Diffstat (limited to 'moses/Phrase.h')
-rw-r--r-- | moses/Phrase.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/moses/Phrase.h b/moses/Phrase.h index a3d58f5d8..4fbf83ba6 100644 --- a/moses/Phrase.h +++ b/moses/Phrase.h @@ -192,6 +192,8 @@ public: return Compare(compare) < 0; } + size_t hash() const; + bool operator==(const Phrase &compare) const; bool operator!=(const Phrase &compare) const { @@ -204,11 +206,7 @@ public: inline size_t hash_value(const Phrase& phrase) { - size_t seed = 0; - for (size_t i = 0; i < phrase.GetSize(); ++i) { - boost::hash_combine(seed, phrase.GetWord(i)); - } - return seed; + return phrase.hash(); } struct PhrasePtrComparator { |