diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2015-10-12 16:31:29 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2015-10-12 16:31:29 +0300 |
commit | 6b182ee5e987a5b2823aea7eaaa7ef0457c6a30d (patch) | |
tree | 1016815a41605c85765312d00172b3c602da8db6 /moses/Hypothesis.cpp | |
parent | b0248f8ad53012e7f2b43f88ce67747403c41a80 (diff) |
pb framework for using boost::unordered_set instead of std::set
Diffstat (limited to 'moses/Hypothesis.cpp')
-rw-r--r-- | moses/Hypothesis.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/moses/Hypothesis.cpp b/moses/Hypothesis.cpp index 5a7833c9f..e3455a1a7 100644 --- a/moses/Hypothesis.cpp +++ b/moses/Hypothesis.cpp @@ -647,6 +647,28 @@ GetPlaceholders(const Hypothesis &hypo, FactorType placeholderFactor) const return ret; } +size_t Hypothesis::hash() const +{ + size_t seed = 0; + BOOST_FOREACH(const FFState *state, m_ffStates) { + size_t hash = state->hash(); + boost::hash_combine(seed ,hash); + } + return seed; +} + +bool Hypothesis::operator==(const Hypothesis& other) const +{ + for (size_t i = 0; i < m_ffStates.size(); ++i) { + const FFState &thisState = *m_ffStates[i]; + const FFState &otherState = *other.m_ffStates[i]; + if (thisState != otherState) { + return false; + } + } + return true; +} + #ifdef HAVE_XMLRPC_C void Hypothesis:: |