Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/giza-pp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Schmidt <git@ryandesign.com>2019-11-02 13:15:00 +0300
committerRyan Schmidt <git@ryandesign.com>2019-11-02 13:15:00 +0300
commit9150b65f3d73c4f9470d5f5d2c8a7bd9d5619b41 (patch)
treec813685e0cad66d1a5d8fd40f934c1efcbe14b9e
parent66deb65eb5161b7d153283aecb48b4334df13786 (diff)
Allow building with libc++ and C++11
Inspired by http://catherinegasnier.blogspot.com/2014/04/install-giza-107-on-mac-osx-1092.html Closes: #1
-rw-r--r--GIZA++-v2/mystl.h6
-rw-r--r--mkcls-v2/myleda.h8
-rw-r--r--mkcls-v2/mystl.h8
3 files changed, 21 insertions, 1 deletions
diff --git a/GIZA++-v2/mystl.h b/GIZA++-v2/mystl.h
index a3a6e41..66baa27 100644
--- a/GIZA++-v2/mystl.h
+++ b/GIZA++-v2/mystl.h
@@ -25,9 +25,13 @@ using namespace _STL;
#include <ext/hash_map>
using __gnu_cxx::hash_map;
#else
+#if __cplusplus < 201103L && !defined(_LIBCPP_VERSION)
#include <tr1/unordered_map>
-#define hash_map unordered_map
using namespace std::tr1;
+#else
+#include <unordered_map>
+#endif
+#define hash_map unordered_map
#endif
#include <vector>
diff --git a/mkcls-v2/myleda.h b/mkcls-v2/myleda.h
index 81091c9..832339d 100644
--- a/mkcls-v2/myleda.h
+++ b/mkcls-v2/myleda.h
@@ -27,7 +27,11 @@ USA.
#define myleda_HEADER_defined
#include <map>
#include <set>
+#if __cplusplus < 201103L && !defined(_LIBCPP_VERSION)
#include <tr1/unordered_map>
+#else
+#include <unordered_map>
+#endif
#include "myassert.h"
#include "FixedArray.h"
using namespace std;
@@ -110,7 +114,11 @@ public:
};
inline int Hash(int value) { return value; }
+#if __cplusplus < 201103L && !defined(_LIBCPP_VERSION)
#define MY_HASH_BASE std::tr1::unordered_map<A,B>
+#else
+#define MY_HASH_BASE unordered_map<A,B>
+#endif
template<class A,class B>
class leda_h_array : public MY_HASH_BASE
diff --git a/mkcls-v2/mystl.h b/mkcls-v2/mystl.h
index 0eb311f..2d8f9ca 100644
--- a/mkcls-v2/mystl.h
+++ b/mkcls-v2/mystl.h
@@ -27,13 +27,19 @@ USA.
#define MY_STL_H_DEFINED
#include <string>
#include <utility>
+#if __cplusplus < 201103L && !defined(_LIBCPP_VERSION)
#include <tr1/unordered_map>
+#else
+#include <unordered_map>
+#endif
#include <cmath>
using namespace std;
namespace std {
+#if __cplusplus < 201103L && !defined(_LIBCPP_VERSION)
namespace tr1 {
+#endif
template <typename T, typename V>
struct hash<pair<T, V> > {
static inline void hash_combine(std::size_t & seed, const T & v) {
@@ -48,7 +54,9 @@ namespace std {
return h;
}
};
+#if __cplusplus < 201103L && !defined(_LIBCPP_VERSION)
}
+#endif
}
#define over_string(a,i) for(unsigned int i=0;i<a.length();i++)