diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2015-10-26 14:59:20 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2015-10-26 14:59:20 +0300 |
commit | 20e3827ed20365d96dad27c751596613da0a2370 (patch) | |
tree | 21c217e3bde16f1f0c861da1d7c073853779abf0 /moses | |
parent | a811166a1acadfa3f6adef0625fb29a505ac356e (diff) |
make Bitmap constructor explicit in case we accidently create a copy during cube pruning algorithm
Diffstat (limited to 'moses')
-rw-r--r-- | moses/Bitmap.h | 8 | ||||
-rw-r--r-- | moses/FF/BleuScoreFeature.cpp | 2 | ||||
-rw-r--r-- | moses/FF/OSM-Feature/OpSequenceModel.cpp | 2 | ||||
-rw-r--r-- | moses/SearchNormal.cpp | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/moses/Bitmap.h b/moses/Bitmap.h index c06120abb..08157b14d 100644 --- a/moses/Bitmap.h +++ b/moses/Bitmap.h @@ -96,15 +96,15 @@ private: public: //! Create Bitmap of length size, and initialise with vector. - Bitmap(size_t size, const std::vector<bool>& initializer); + explicit Bitmap(size_t size, const std::vector<bool>& initializer); //! Create Bitmap of length size and initialise. - Bitmap(size_t size); + explicit Bitmap(size_t size); //! Deep copy. - Bitmap(const Bitmap ©); + explicit Bitmap(const Bitmap ©); - Bitmap(const Bitmap ©, const Range &range); + explicit Bitmap(const Bitmap ©, const Range &range); //! Count of words translated. size_t GetNumWordsCovered() const { diff --git a/moses/FF/BleuScoreFeature.cpp b/moses/FF/BleuScoreFeature.cpp index eaecd59af..f02230455 100644 --- a/moses/FF/BleuScoreFeature.cpp +++ b/moses/FF/BleuScoreFeature.cpp @@ -538,7 +538,7 @@ FFState* BleuScoreFeature::EvaluateWhenApplied(const Hypothesis& cur_hypo, ctx_start_idx = 0; } - Bitmap coverageVector = cur_hypo.GetWordsBitmap(); + const Bitmap &coverageVector = cur_hypo.GetWordsBitmap(); new_state->m_source_length = coverageVector.GetNumWordsCovered(); new_state->m_words = new_words.GetSubString(Range(ctx_start_idx, diff --git a/moses/FF/OSM-Feature/OpSequenceModel.cpp b/moses/FF/OSM-Feature/OpSequenceModel.cpp index db62c45bf..8153debbd 100644 --- a/moses/FF/OSM-Feature/OpSequenceModel.cpp +++ b/moses/FF/OSM-Feature/OpSequenceModel.cpp @@ -94,7 +94,7 @@ FFState* OpSequenceModel::EvaluateWhenApplied( { const TargetPhrase &target = cur_hypo.GetCurrTargetPhrase(); const Bitmap &bitmap = cur_hypo.GetWordsBitmap(); - Bitmap myBitmap = bitmap; + Bitmap myBitmap(bitmap); const Manager &manager = cur_hypo.GetManager(); const InputType &source = manager.GetSource(); // const Sentence &sourceSentence = static_cast<const Sentence&>(source); diff --git a/moses/SearchNormal.cpp b/moses/SearchNormal.cpp index bc8be525f..62bf420fc 100644 --- a/moses/SearchNormal.cpp +++ b/moses/SearchNormal.cpp @@ -112,7 +112,7 @@ ProcessOneHypothesis(const Hypothesis &hypothesis) // int maxDistortion = StaticData::Instance().GetMaxDistortion(); bool isWordLattice = m_source.GetType() == WordLatticeInput; - const Bitmap hypoBitmap = hypothesis.GetWordsBitmap(); + const Bitmap &hypoBitmap = hypothesis.GetWordsBitmap(); const size_t hypoFirstGapPos = hypoBitmap.GetFirstGapPos(); size_t const sourceSize = m_source.GetSize(); |