Add a phrase default constructor, bypassing the array size increment

This commit is contained in:
Kenneth Heafield 2012-10-22 13:17:46 -04:00
parent 2e8c316aaa
commit eb28ea26a8
3 changed files with 6 additions and 3 deletions

View File

@ -37,6 +37,8 @@ using namespace std;
namespace Moses
{
Phrase::Phrase() {}
Phrase::Phrase(size_t reserveSize)
{
m_words.reserve(reserveSize);

View File

@ -57,6 +57,7 @@ public:
/** create empty phrase
*/
Phrase();
explicit Phrase(size_t reserveSize);
/** create phrase from vectors of words */
explicit Phrase(const std::vector< const Word* > &mergeWords);

View File

@ -53,9 +53,9 @@ TargetPhrase::TargetPhrase( std::string out_string)
TargetPhrase::TargetPhrase()
:Phrase(ARRAY_SIZE_INCR)
:Phrase()
, m_fullScore(0.0)
,m_sourcePhrase(0)
,m_sourcePhrase()
, m_alignTerm(&AlignmentInfoCollection::Instance().GetEmptyAlignmentInfo())
, m_alignNonTerm(&AlignmentInfoCollection::Instance().GetEmptyAlignmentInfo())
{
@ -64,7 +64,7 @@ TargetPhrase::TargetPhrase()
TargetPhrase::TargetPhrase(const Phrase &phrase)
: Phrase(phrase)
, m_fullScore(0.0)
, m_sourcePhrase(0)
, m_sourcePhrase()
, m_alignTerm(&AlignmentInfoCollection::Instance().GetEmptyAlignmentInfo())
, m_alignNonTerm(&AlignmentInfoCollection::Instance().GetEmptyAlignmentInfo())
{