mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-28 14:32:38 +03:00
Remove more unnecessary dynamic casts
This commit is contained in:
parent
6cffb39bd6
commit
a797582e89
@ -71,7 +71,7 @@ FFState* LexicalReordering::Evaluate(const Hypothesis& hypo,
|
||||
ScoreComponentCollection* out) const
|
||||
{
|
||||
Scores score(GetNumScoreComponents(), 0);
|
||||
const LexicalReorderingState *prev = dynamic_cast<const LexicalReorderingState *>(prev_state);
|
||||
const LexicalReorderingState *prev = static_cast<const LexicalReorderingState *>(prev_state);
|
||||
LexicalReorderingState *next_state = prev->Expand(hypo.GetTranslationOption(), score);
|
||||
|
||||
out->PlusEquals(this, score);
|
||||
|
@ -291,7 +291,7 @@ int BidirectionalReorderingState::Compare(const FFState& o) const
|
||||
if (&o == this)
|
||||
return 0;
|
||||
|
||||
const BidirectionalReorderingState &other = dynamic_cast<const BidirectionalReorderingState &>(o);
|
||||
const BidirectionalReorderingState &other = static_cast<const BidirectionalReorderingState &>(o);
|
||||
if(m_backward->Compare(*other.m_backward) < 0)
|
||||
return -1;
|
||||
else if(m_backward->Compare(*other.m_backward) > 0)
|
||||
@ -320,7 +320,7 @@ HierarchicalReorderingBackwardState::HierarchicalReorderingBackwardState(const L
|
||||
|
||||
int HierarchicalReorderingBackwardState::Compare(const FFState& o) const
|
||||
{
|
||||
const HierarchicalReorderingBackwardState& other = dynamic_cast<const HierarchicalReorderingBackwardState&>(o);
|
||||
const HierarchicalReorderingBackwardState& other = static_cast<const HierarchicalReorderingBackwardState&>(o);
|
||||
return m_reoStack.Compare(other.m_reoStack);
|
||||
}
|
||||
|
||||
@ -406,8 +406,7 @@ int HierarchicalReorderingForwardState::Compare(const FFState& o) const
|
||||
if (&o == this)
|
||||
return 0;
|
||||
|
||||
const HierarchicalReorderingForwardState* other = dynamic_cast<const HierarchicalReorderingForwardState*>(&o);
|
||||
UTIL_THROW_IF2(other == NULL, "Wrong state type");
|
||||
const HierarchicalReorderingForwardState* other = static_cast<const HierarchicalReorderingForwardState*>(&o);
|
||||
|
||||
if (m_prevRange == other->m_prevRange) {
|
||||
return ComparePrevScores(other->m_prevScore);
|
||||
|
Loading…
Reference in New Issue
Block a user