diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2012-03-20 15:37:54 -0400 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2012-03-20 15:37:54 -0400 |
commit | 34b4752a1eefc002166e95782c2c52747bb08b3a (patch) | |
tree | 0045687d1de1d539cd232ba4e71940e9baee72c0 /mira | |
parent | 0b598b997a7c1d2d9dc255cc2ff1bf9bb2c425a1 (diff) |
make c++11 compatible
Diffstat (limited to 'mira')
-rw-r--r-- | mira/kbest_mira.cc | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/mira/kbest_mira.cc b/mira/kbest_mira.cc index 904eba74..dc0200d6 100644 --- a/mira/kbest_mira.cc +++ b/mira/kbest_mira.cc @@ -3,10 +3,10 @@ #include <vector> #include <cassert> #include <cmath> +#include <tr1/memory> #include "config.h" -#include <boost/shared_ptr.hpp> #include <boost/program_options.hpp> #include <boost/program_options/variables_map.hpp> @@ -27,11 +27,10 @@ #include "sampler.h" using namespace std; -using boost::shared_ptr; namespace po = boost::program_options; bool invert_score; -boost::shared_ptr<MT19937> rng; +std::tr1::shared_ptr<MT19937> rng; void RandomPermutation(int len, vector<int>* p_ids) { vector<int>& ids = *p_ids; @@ -89,15 +88,15 @@ struct HypothesisInfo { }; struct GoodBadOracle { - shared_ptr<HypothesisInfo> good; - shared_ptr<HypothesisInfo> bad; + std::tr1::shared_ptr<HypothesisInfo> good; + std::tr1::shared_ptr<HypothesisInfo> bad; }; struct TrainingObserver : public DecoderObserver { TrainingObserver(const int k, const DocScorer& d, bool sf, vector<GoodBadOracle>* o) : ds(d), oracles(*o), kbest_size(k), sample_forest(sf) {} const DocScorer& ds; vector<GoodBadOracle>& oracles; - shared_ptr<HypothesisInfo> cur_best; + std::tr1::shared_ptr<HypothesisInfo> cur_best; const int kbest_size; const bool sample_forest; @@ -109,16 +108,16 @@ struct TrainingObserver : public DecoderObserver { UpdateOracles(smeta.GetSentenceID(), *hg); } - shared_ptr<HypothesisInfo> MakeHypothesisInfo(const SparseVector<double>& feats, const double score) { - shared_ptr<HypothesisInfo> h(new HypothesisInfo); + std::tr1::shared_ptr<HypothesisInfo> MakeHypothesisInfo(const SparseVector<double>& feats, const double score) { + std::tr1::shared_ptr<HypothesisInfo> h(new HypothesisInfo); h->features = feats; h->mt_metric = score; return h; } void UpdateOracles(int sent_id, const Hypergraph& forest) { - shared_ptr<HypothesisInfo>& cur_good = oracles[sent_id].good; - shared_ptr<HypothesisInfo>& cur_bad = oracles[sent_id].bad; + std::tr1::shared_ptr<HypothesisInfo>& cur_good = oracles[sent_id].good; + std::tr1::shared_ptr<HypothesisInfo>& cur_bad = oracles[sent_id].bad; cur_bad.reset(); // TODO get rid of?? if (sample_forest) { |