diff --git a/contrib/other-builds/moses2/Search/CubePruning/Stack.cpp b/contrib/other-builds/moses2/Search/CubePruning/Stack.cpp index 38aee040b..9475281fa 100644 --- a/contrib/other-builds/moses2/Search/CubePruning/Stack.cpp +++ b/contrib/other-builds/moses2/Search/CubePruning/Stack.cpp @@ -82,12 +82,14 @@ void MiniStack::SortAndPruneHypos(const Manager &mgr) const /////////////////////////////////////////////////////////////// Stack::Stack(const Manager &mgr) :m_alloc(mgr.GetPool()) -,m_coll(m_alloc) { + MemPool &pool = mgr.GetPool(); + m_coll = new (pool.Allocate()) Coll(m_alloc); } Stack::~Stack() { + //delete m_coll; } void Stack::Add(const Hypothesis *hypo, Recycler &hypoRecycle) @@ -137,7 +139,7 @@ StackAdd Stack::Add(const Hypothesis *hypo) std::vector Stack::GetBestHypos(size_t num) const { std::vector ret; - BOOST_FOREACH(const Coll::value_type &val, m_coll) { + BOOST_FOREACH(const Coll::value_type &val, *m_coll) { const MiniStack::_HCType &hypos = val.second.GetColl(); ret.insert(ret.end(), hypos.begin(), hypos.end()); } @@ -156,7 +158,7 @@ std::vector Stack::GetBestHypos(size_t num) const size_t Stack::GetHypoSize() const { size_t ret = 0; - BOOST_FOREACH(const Coll::value_type &val, m_coll) { + BOOST_FOREACH(const Coll::value_type &val, *m_coll) { const MiniStack::_HCType &hypos = val.second.GetColl(); ret += hypos.size(); } @@ -177,7 +179,7 @@ MiniStack &Stack::GetMiniStack(const HypoCoverage &key) } return *ret; */ - return m_coll[key]; + return (*m_coll)[key]; } } diff --git a/contrib/other-builds/moses2/Search/CubePruning/Stack.h b/contrib/other-builds/moses2/Search/CubePruning/Stack.h index 8f8585e3c..3ab887e6c 100644 --- a/contrib/other-builds/moses2/Search/CubePruning/Stack.h +++ b/contrib/other-builds/moses2/Search/CubePruning/Stack.h @@ -73,19 +73,19 @@ public: size_t GetHypoSize() const; Coll &GetColl() - { return m_coll; } + { return *m_coll; } void Add(const Hypothesis *hypo, Recycler &hypoRecycle); std::vector GetBestHypos(size_t num) const; void Clear() { - m_coll.clear(); + m_coll->clear(); } protected: MemPoolAllocator< std::pair > m_alloc; - Coll m_coll; + Coll *m_coll; StackAdd Add(const Hypothesis *hypo);