summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Dyer <cdyer@allegro.clab.cs.cmu.edu>2013-11-10 01:46:28 -0500
committerChris Dyer <cdyer@allegro.clab.cs.cmu.edu>2013-11-10 01:46:28 -0500
commit1e9afb904a57ff0b03edd0e94d634ef98e7d4b2a (patch)
tree24aef25a92bbef43224c6c4c8a082d0256b70640
parentda179c9cbe92d93c5e7bfb1dbe1b3bec2c7791b9 (diff)
fix for c++11
-rw-r--r--.gitignore2
-rw-r--r--decoder/apply_models.cc2
-rw-r--r--decoder/decoder.cc2
-rw-r--r--decoder/earley_composer.cc2
-rw-r--r--decoder/ff_source_syntax.cc2
-rw-r--r--decoder/ff_source_syntax2_p.cc2
-rw-r--r--decoder/ff_source_syntax_p.cc2
-rw-r--r--decoder/ff_wordalign.cc2
-rw-r--r--decoder/ff_wordalign.h2
-rw-r--r--decoder/ff_wordset.h2
-rw-r--r--decoder/grammar.cc2
-rw-r--r--decoder/hg_intersect.cc2
-rw-r--r--decoder/kbest.h2
-rw-r--r--decoder/maxtrans_blunsom.cc2
-rw-r--r--decoder/phrasebased_translator.cc2
-rw-r--r--python/cdec/sa/strmap.cc2
-rw-r--r--python/setup.py.in3
-rw-r--r--training/latent_svm/latent_svm.cc13
-rw-r--r--training/mira/kbest_cut_mira.cc7
-rw-r--r--training/utils/candidate_set.cc2
-rw-r--r--word-aligner/fast_align.cc2
-rw-r--r--word-aligner/ttables.h2
22 files changed, 27 insertions, 34 deletions
diff --git a/.gitignore b/.gitignore
index 697a1a9d..5f573137 100644
--- a/.gitignore
+++ b/.gitignore
@@ -103,7 +103,7 @@ jam-files/bjam
jam-files/engine/bin.*
jam-files/engine/bootstrap/
klm/lm/bin/
-klm/lm/builder/builder
+klm/lm/builder/lmplz
klm/lm/build_binary
klm/lm/ngram_query
klm/lm/query
diff --git a/decoder/apply_models.cc b/decoder/apply_models.cc
index 2e093d6a..4cd8b36f 100644
--- a/decoder/apply_models.cc
+++ b/decoder/apply_models.cc
@@ -8,7 +8,7 @@
#include <vector>
#include <algorithm>
-#ifdef HAVE_CXX11
+#ifndef HAVE_OLD_CPP
# include <unordered_map>
# include <unordered_set>
#else
diff --git a/decoder/decoder.cc b/decoder/decoder.cc
index 2c0e07b7..da65713a 100644
--- a/decoder/decoder.cc
+++ b/decoder/decoder.cc
@@ -1,6 +1,6 @@
#include "decoder.h"
-#ifdef HAVE_CXX11
+#ifndef HAVE_OLD_CPP
# include <unordered_map>
#else
# include <tr1/unordered_map>
diff --git a/decoder/earley_composer.cc b/decoder/earley_composer.cc
index 32c387d3..d47a6969 100644
--- a/decoder/earley_composer.cc
+++ b/decoder/earley_composer.cc
@@ -4,7 +4,7 @@
#include <fstream>
#include <map>
#include <queue>
-#ifdef HAVE_CXX11
+#ifndef HAVE_OLD_CPP
# include <unordered_map>
# include <unordered_set>
#else
diff --git a/decoder/ff_source_syntax.cc b/decoder/ff_source_syntax.cc
index 95709076..88f6714c 100644
--- a/decoder/ff_source_syntax.cc
+++ b/decoder/ff_source_syntax.cc
@@ -2,7 +2,7 @@
#include <sstream>
#include <stack>
-#ifdef HAVE_CXX11
+#ifndef HAVE_OLD_CPP
# include <unordered_set>
#else
# include <tr1/unordered_set>
diff --git a/decoder/ff_source_syntax2_p.cc b/decoder/ff_source_syntax2_p.cc
index 130144fa..6a2ae742 100644
--- a/decoder/ff_source_syntax2_p.cc
+++ b/decoder/ff_source_syntax2_p.cc
@@ -3,7 +3,7 @@
#include <sstream>
#include <stack>
#include <string>
-#ifdef HAVE_CXX11
+#ifndef HAVE_OLD_CPP
# include <unordered_set>
#else
# include <tr1/unordered_set>
diff --git a/decoder/ff_source_syntax_p.cc b/decoder/ff_source_syntax_p.cc
index 1d3dc497..c094de59 100644
--- a/decoder/ff_source_syntax_p.cc
+++ b/decoder/ff_source_syntax_p.cc
@@ -2,7 +2,7 @@
#include <sstream>
#include <stack>
-#ifdef HAVE_CXX11
+#ifndef HAVE_OLD_CPP
# include <unordered_set>
#else
# include <tr1/unordered_set>
diff --git a/decoder/ff_wordalign.cc b/decoder/ff_wordalign.cc
index 8ed053c2..dcb80110 100644
--- a/decoder/ff_wordalign.cc
+++ b/decoder/ff_wordalign.cc
@@ -7,7 +7,7 @@
#include <string>
#include <cmath>
#include <bitset>
-#ifdef HAVE_CXX11
+#ifndef HAVE_OLD_CPP
# include <unordered_map>
#else
# include <tr1/unordered_map>
diff --git a/decoder/ff_wordalign.h b/decoder/ff_wordalign.h
index 50f0dafa..0161f603 100644
--- a/decoder/ff_wordalign.h
+++ b/decoder/ff_wordalign.h
@@ -9,7 +9,7 @@
#include <cassert>
#include <boost/scoped_ptr.hpp>
#include <boost/multi_array.hpp>
-#ifdef HAVE_CXX11
+#ifndef HAVE_OLD_CPP
# include <unordered_map>
#else
# include <tr1/unordered_map>
diff --git a/decoder/ff_wordset.h b/decoder/ff_wordset.h
index affee2f4..e78cd2fb 100644
--- a/decoder/ff_wordset.h
+++ b/decoder/ff_wordset.h
@@ -9,7 +9,7 @@
#include <iostream>
#include <fstream>
-#ifdef HAVE_CXX11
+#ifndef HAVE_OLD_CPP
# include <unordered_set>
#else
# include <tr1/unordered_set>
diff --git a/decoder/grammar.cc b/decoder/grammar.cc
index f2530d35..160d00e6 100644
--- a/decoder/grammar.cc
+++ b/decoder/grammar.cc
@@ -3,7 +3,7 @@
#include <algorithm>
#include <utility>
#include <map>
-#ifdef HAVE_CXX11
+#ifndef HAVE_OLD_CPP
# include <unordered_map>
# include <unordered_set>
#else
diff --git a/decoder/hg_intersect.cc b/decoder/hg_intersect.cc
index c5f1cc91..31a9a1ce 100644
--- a/decoder/hg_intersect.cc
+++ b/decoder/hg_intersect.cc
@@ -1,7 +1,7 @@
#include "hg_intersect.h"
#include <vector>
-#ifdef HAVE_CXX11
+#ifndef HAVE_OLD_CPP
# include <unordered_map>
#else
# include <tr1/unordered_map>
diff --git a/decoder/kbest.h b/decoder/kbest.h
index cd386aef..c7194c7e 100644
--- a/decoder/kbest.h
+++ b/decoder/kbest.h
@@ -3,7 +3,7 @@
#include <vector>
#include <utility>
-#ifdef HAVE_CXX11
+#ifndef HAVE_OLD_CPP
# include <unordered_set>
#else
# include <tr1/unordered_set>
diff --git a/decoder/maxtrans_blunsom.cc b/decoder/maxtrans_blunsom.cc
index 8d1d471c..a9f65fab 100644
--- a/decoder/maxtrans_blunsom.cc
+++ b/decoder/maxtrans_blunsom.cc
@@ -2,7 +2,7 @@
#include <vector>
#include <algorithm>
-#ifdef HAVE_CXX11
+#ifndef HAVE_OLD_CPP
# include <unordered_map>
# include <unordered_set>
#else
diff --git a/decoder/phrasebased_translator.cc b/decoder/phrasebased_translator.cc
index 321fb286..04b3e5d2 100644
--- a/decoder/phrasebased_translator.cc
+++ b/decoder/phrasebased_translator.cc
@@ -2,7 +2,7 @@
#include <queue>
#include <iostream>
-#ifdef HAVE_CXX11
+#ifndef HAVE_OLD_CPP
# include <unordered_map>
# include <unordered_set>
#else
diff --git a/python/cdec/sa/strmap.cc b/python/cdec/sa/strmap.cc
index d7c4f2a3..b6debfb0 100644
--- a/python/cdec/sa/strmap.cc
+++ b/python/cdec/sa/strmap.cc
@@ -4,7 +4,7 @@
#include <string>
#include <cstdint>
-#ifdef HAVE_CXX11
+#ifndef HAVE_OLD_CPP
# include <unordered_map>
#else
# include <tr1/unordered_map>
diff --git a/python/setup.py.in b/python/setup.py.in
index ce1eb2ed..8ed0b100 100644
--- a/python/setup.py.in
+++ b/python/setup.py.in
@@ -21,7 +21,8 @@ ext_modules = [
extra_compile_args=CPPFLAGS,
extra_link_args=LDFLAGS),
Extension(name='cdec.sa._sa',
- sources=['cdec/sa/_sa.c', 'cdec/sa/strmap.cc'])
+ sources=['cdec/sa/_sa.c', 'cdec/sa/strmap.cc'],
+ extra_compile_args=CPPFLAGS)
]
setup(
diff --git a/training/latent_svm/latent_svm.cc b/training/latent_svm/latent_svm.cc
index ab9c1d5d..60e52550 100644
--- a/training/latent_svm/latent_svm.cc
+++ b/training/latent_svm/latent_svm.cc
@@ -32,7 +32,6 @@ total_loss and prev_loss actually refer not to loss, but the metric (usually BLE
#include "sampler.h"
using namespace std;
-using boost::shared_ptr;
namespace po = boost::program_options;
bool invert_score;
@@ -128,7 +127,7 @@ struct HypothesisInfo {
};
struct GoodOracle {
- shared_ptr<HypothesisInfo> good;
+ boost::shared_ptr<HypothesisInfo> good;
};
struct TrainingObserver : public DecoderObserver {
@@ -143,9 +142,9 @@ struct TrainingObserver : public DecoderObserver {
const DocScorer& ds;
const vector<weight_t>& feature_weights;
vector<GoodOracle>& oracles;
- shared_ptr<HypothesisInfo> cur_best;
- shared_ptr<HypothesisInfo> cur_costaug_best;
- shared_ptr<HypothesisInfo> cur_ref;
+ boost::shared_ptr<HypothesisInfo> cur_best;
+ boost::shared_ptr<HypothesisInfo> cur_costaug_best;
+ boost::shared_ptr<HypothesisInfo> cur_ref;
const int kbest_size;
const double mt_metric_scale;
const double mu;
@@ -168,8 +167,8 @@ struct TrainingObserver : public DecoderObserver {
UpdateOracles(smeta.GetSentenceID(), *hg);
}
- shared_ptr<HypothesisInfo> MakeHypothesisInfo(const SparseVector<double>& feats, const double metric) {
- shared_ptr<HypothesisInfo> h(new HypothesisInfo);
+ boost::shared_ptr<HypothesisInfo> MakeHypothesisInfo(const SparseVector<double>& feats, const double metric) {
+ boost::shared_ptr<HypothesisInfo> h(new HypothesisInfo);
h->features = feats;
h->mt_metric_score = metric;
return h;
diff --git a/training/mira/kbest_cut_mira.cc b/training/mira/kbest_cut_mira.cc
index 3b1108e0..990609d7 100644
--- a/training/mira/kbest_cut_mira.cc
+++ b/training/mira/kbest_cut_mira.cc
@@ -49,13 +49,6 @@ bool sent_approx;
bool checkloss;
bool stream;
-void SanityCheck(const vector<double>& w) {
- for (int i = 0; i < w.size(); ++i) {
- assert(!isnan(w[i]));
- assert(!isinf(w[i]));
- }
-}
-
struct FComp {
const vector<double>& w_;
FComp(const vector<double>& w) : w_(w) {}
diff --git a/training/utils/candidate_set.cc b/training/utils/candidate_set.cc
index 1dec9609..33dae9a3 100644
--- a/training/utils/candidate_set.cc
+++ b/training/utils/candidate_set.cc
@@ -1,6 +1,6 @@
#include "candidate_set.h"
-#ifdef HAVE_CXX11
+#ifndef HAVE_OLD_CPP
# include <unordered_set>
#else
# include <tr1/unordered_set>
diff --git a/word-aligner/fast_align.cc b/word-aligner/fast_align.cc
index 589ca62d..f54233eb 100644
--- a/word-aligner/fast_align.cc
+++ b/word-aligner/fast_align.cc
@@ -1,7 +1,7 @@
#include <iostream>
#include <cmath>
#include <utility>
-#ifdef HAVE_CXX11
+#ifndef HAVE_OLD_CPP
# include <unordered_map>
#else
# include <tr1/unordered_map>
diff --git a/word-aligner/ttables.h b/word-aligner/ttables.h
index 1785e064..d82aff72 100644
--- a/word-aligner/ttables.h
+++ b/word-aligner/ttables.h
@@ -2,7 +2,7 @@
#define _TTABLES_H_
#include <iostream>
-#ifdef HAVE_CXX11
+#ifndef HAVE_OLD_CPP
# include <unordered_map>
#else
# include <tr1/unordered_map>