mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-11-05 03:24:07 +03:00
31 lines
494 B
C++
31 lines
494 B
C++
|
|
#include "HypothesisStack.h"
|
|
|
|
namespace Moses
|
|
{
|
|
HypothesisStack::~HypothesisStack()
|
|
{
|
|
// delete all hypos
|
|
while (m_hypos.begin() != m_hypos.end()) {
|
|
Remove(m_hypos.begin());
|
|
}
|
|
}
|
|
|
|
/** Remove hypothesis pointed to by iterator but don't delete the object. */
|
|
void HypothesisStack::Detach(const HypothesisStack::iterator &iter)
|
|
{
|
|
m_hypos.erase(iter);
|
|
}
|
|
|
|
|
|
void HypothesisStack::Remove(const HypothesisStack::iterator &iter)
|
|
{
|
|
Hypothesis *h = *iter;
|
|
Detach(iter);
|
|
delete h;
|
|
}
|
|
|
|
|
|
}
|
|
|