diff options
author | Chris Dyer <cdyer@Chriss-MacBook-Air.local> | 2013-11-10 00:58:44 -0500 |
---|---|---|
committer | Chris Dyer <cdyer@Chriss-MacBook-Air.local> | 2013-11-10 00:58:44 -0500 |
commit | d9cc1a6986188a97e09e4c8cef46c34eee5f9cd2 (patch) | |
tree | 662e45620fcf5b27f6a6edb5a5c105a0514e51cd /word-aligner | |
parent | db0dcd780abea416cfdb2b2382152dbe11c35170 (diff) |
guard against direct includes of tr1
Diffstat (limited to 'word-aligner')
-rw-r--r-- | word-aligner/fast_align.cc | 8 | ||||
-rw-r--r-- | word-aligner/ttables.cc | 1 | ||||
-rw-r--r-- | word-aligner/ttables.h | 11 |
3 files changed, 14 insertions, 6 deletions
diff --git a/word-aligner/fast_align.cc b/word-aligner/fast_align.cc index fddcba9c..589ca62d 100644 --- a/word-aligner/fast_align.cc +++ b/word-aligner/fast_align.cc @@ -1,7 +1,12 @@ #include <iostream> #include <cmath> #include <utility> -#include <tr1/unordered_map> +#ifdef HAVE_CXX11 +# include <unordered_map> +#else +# include <tr1/unordered_map> +namespace std { using std::tr1::unordered_map; } +#endif #include <boost/functional/hash.hpp> #include <boost/program_options.hpp> @@ -17,7 +22,6 @@ namespace po = boost::program_options; using namespace std; -using namespace std::tr1; bool InitCommandLine(int argc, char** argv, po::variables_map* conf) { po::options_description opts("Configuration options"); diff --git a/word-aligner/ttables.cc b/word-aligner/ttables.cc index c177aa30..a56bbcef 100644 --- a/word-aligner/ttables.cc +++ b/word-aligner/ttables.cc @@ -5,7 +5,6 @@ #include "dict.h" using namespace std; -using namespace std::tr1; void TTable::DeserializeProbsFromText(std::istream* in) { int c = 0; diff --git a/word-aligner/ttables.h b/word-aligner/ttables.h index 507f591a..1785e064 100644 --- a/word-aligner/ttables.h +++ b/word-aligner/ttables.h @@ -2,7 +2,12 @@ #define _TTABLES_H_ #include <iostream> -#include <tr1/unordered_map> +#ifdef HAVE_CXX11 +# include <unordered_map> +#else +# include <tr1/unordered_map> +namespace std { using std::tr1::unordered_map; } +#endif #include "sparse_vector.h" #include "m.h" @@ -12,8 +17,8 @@ class TTable { public: TTable() {} - typedef std::tr1::unordered_map<WordID, double> Word2Double; - typedef std::tr1::unordered_map<WordID, Word2Double> Word2Word2Double; + typedef std::unordered_map<WordID, double> Word2Double; + typedef std::unordered_map<WordID, Word2Double> Word2Word2Double; inline double prob(const int& e, const int& f) const { const Word2Word2Double::const_iterator cit = ttable.find(e); if (cit != ttable.end()) { |