mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-05 02:22:21 +03:00
delete all memtion of shared ptr
This commit is contained in:
parent
a1a380f806
commit
3e7d2c9497
@ -37,18 +37,7 @@ void InputPath::AddTargetPhrases(const PhraseTable &pt, const TargetPhrases *tps
|
||||
m_isUsed = true;
|
||||
}
|
||||
}
|
||||
/*
|
||||
bool InputPath::IsUsed() const
|
||||
{
|
||||
BOOST_FOREACH(const TargetPhrases::shared_const_ptr &sharedPtr, targetPhrases) {
|
||||
const TargetPhrases *tps = sharedPtr.get();
|
||||
if (tps && tps->GetSize()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
std::ostream& operator<<(std::ostream &out, const InputPath &obj)
|
||||
{
|
||||
out << obj.range << " " << obj.subPhrase;
|
||||
|
@ -17,9 +17,6 @@ class TargetPhrases {
|
||||
friend std::ostream& operator<<(std::ostream &, const TargetPhrases &);
|
||||
typedef Vector<const TargetPhrase*> Coll;
|
||||
public:
|
||||
typedef boost::shared_ptr<TargetPhrases> shared_ptr;
|
||||
typedef boost::shared_ptr<TargetPhrases const> shared_const_ptr;
|
||||
|
||||
typedef Coll::iterator iterator;
|
||||
typedef Coll::const_iterator const_iterator;
|
||||
//! iterators
|
||||
|
@ -96,14 +96,14 @@ TargetPhrases* ProbingPT::CreateTargetPhrase(MemPool &pool, const System &system
|
||||
size_t sourceSize = sourcePhrase.GetSize();
|
||||
assert(sourceSize);
|
||||
|
||||
TargetPhrases *tpSharedPtr = NULL;
|
||||
TargetPhrases *tps = NULL;
|
||||
uint64_t probingSource[sourceSize];
|
||||
bool ok;
|
||||
ConvertToProbingSourcePhrase(sourcePhrase, ok, probingSource);
|
||||
if (!ok) {
|
||||
// source phrase contains a word unknown in the pt.
|
||||
// We know immediately there's no translation for it
|
||||
return tpSharedPtr;
|
||||
return tps;
|
||||
}
|
||||
|
||||
std::pair<bool, std::vector<target_text*> > query_result;
|
||||
@ -114,24 +114,24 @@ TargetPhrases* ProbingPT::CreateTargetPhrase(MemPool &pool, const System &system
|
||||
if (query_result.first) {
|
||||
//m_engine->printTargetInfo(query_result.second);
|
||||
const std::vector<target_text*> &probingTargetPhrases = query_result.second;
|
||||
tpSharedPtr = new (pool.Allocate<TargetPhrases>()) TargetPhrases(pool, probingTargetPhrases.size());
|
||||
tps = new (pool.Allocate<TargetPhrases>()) TargetPhrases(pool, probingTargetPhrases.size());
|
||||
|
||||
for (size_t i = 0; i < probingTargetPhrases.size(); ++i) {
|
||||
const target_text *probingTargetPhrase = probingTargetPhrases[i];
|
||||
TargetPhrase *tp = CreateTargetPhrase(pool, system, sourcePhrase, *probingTargetPhrase);
|
||||
|
||||
tpSharedPtr->AddTargetPhrase(*tp);
|
||||
tps->AddTargetPhrase(*tp);
|
||||
|
||||
delete probingTargetPhrase;
|
||||
}
|
||||
|
||||
tpSharedPtr->SortAndPrune(m_tableLimit);
|
||||
tps->SortAndPrune(m_tableLimit);
|
||||
}
|
||||
else {
|
||||
assert(query_result.second.size() == 0);
|
||||
}
|
||||
|
||||
return tpSharedPtr;
|
||||
return tps;
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user