Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2015-10-19 19:22:18 +0300
committerHieu Hoang <hieuhoang@gmail.com>2015-10-19 19:22:18 +0300
commit9891e5b50bbb22b11f4895c8eb7a8bf06993353e (patch)
tree6d206cd3814334a88efd7fbeffa2839c2e412814 /moses/HypothesisStackCubePruning.cpp
parent7d98df2b0c39007c9167c505b73df5ef31ffd69c (diff)
Revert "reuse bitmap key for BitmapContainer"
This reverts commit 7d98df2b0c39007c9167c505b73df5ef31ffd69c.
Diffstat (limited to 'moses/HypothesisStackCubePruning.cpp')
-rw-r--r--moses/HypothesisStackCubePruning.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/moses/HypothesisStackCubePruning.cpp b/moses/HypothesisStackCubePruning.cpp
index 6d9ebf36a..f83c0d234 100644
--- a/moses/HypothesisStackCubePruning.cpp
+++ b/moses/HypothesisStackCubePruning.cpp
@@ -48,7 +48,6 @@ void HypothesisStackCubePruning::RemoveAll()
// delete all bitmap accessors;
_BMType::iterator iter;
for (iter = m_bitmapAccessor.begin(); iter != m_bitmapAccessor.end(); ++iter) {
- delete iter->first;
delete iter->second;
}
}
@@ -150,8 +149,7 @@ void HypothesisStackCubePruning::AddInitial(Hypothesis *hypo)
"Should have added hypothesis " << *hypo);
const WordsBitmap &bitmap = hypo->GetWordsBitmap();
- WordsBitmap *newBitmap = new WordsBitmap(bitmap);
- m_bitmapAccessor[newBitmap] = new BitmapContainer(*newBitmap, *this, m_deterministic);
+ m_bitmapAccessor[bitmap] = new BitmapContainer(bitmap, *this, m_deterministic);
}
void HypothesisStackCubePruning::PruneToSize(size_t newSize)
@@ -257,13 +255,12 @@ void HypothesisStackCubePruning::SetBitmapAccessor(const WordsBitmap &newBitmap
, const SquareMatrix &futureScore
, const TranslationOptionList &transOptList)
{
- _BMType::iterator bcExists = m_bitmapAccessor.find(&newBitmap);
+ _BMType::iterator bcExists = m_bitmapAccessor.find(newBitmap);
BitmapContainer *bmContainer;
if (bcExists == m_bitmapAccessor.end()) {
- WordsBitmap *bm = new WordsBitmap(newBitmap);
- bmContainer = new BitmapContainer(*bm, stack, m_deterministic);
- m_bitmapAccessor[bm] = bmContainer;
+ bmContainer = new BitmapContainer(newBitmap, stack, m_deterministic);
+ m_bitmapAccessor[newBitmap] = bmContainer;
} else {
bmContainer = bcExists->second;
}
@@ -300,7 +297,7 @@ HypothesisStackCubePruning::AddHypothesesToBitmapContainers()
for (iter = m_hypos.begin() ; iter != m_hypos.end() ; ++iter) {
Hypothesis *h = *iter;
const WordsBitmap &bitmap = h->GetWordsBitmap();
- BitmapContainer *container = m_bitmapAccessor[&bitmap];
+ BitmapContainer *container = m_bitmapAccessor[bitmap];
container->AddHypothesis(h);
}
}