Remove more unnecessary dynamic casts

This commit is contained in:
XapaJIaMnu 2014-06-13 17:02:08 +01:00
parent 6cffb39bd6
commit a797582e89
2 changed files with 4 additions and 5 deletions

View File

@ -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);

View File

@ -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);