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:
authorHieu Hoang <hieuhoang@gmail.com>2019-11-02 17:35:00 +0300
committerGitHub <noreply@github.com>2019-11-02 17:35:00 +0300
commitcd8646d2c3f9ad5ef6af6159c65b581813908a25 (patch)
tree1adba7a11baf1e7b7659544409347a5f963b8a08
parent66deb65eb5161b7d153283aecb48b4334df13786 (diff)
parent27dd8dd52120533d6ea465fcb40bd6b6496c1b9f (diff)
Merge pull request #6 from ryandesign/tr1
Allow building with libc++ and C++11
-rw-r--r--GIZA++-v2/mystl.h6
-rw-r--r--README2
-rw-r--r--mkcls-v2/myleda.h8
-rw-r--r--mkcls-v2/mystl.h8
4 files changed, 22 insertions, 2 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/README b/README
index 072b094..0844b4b 100644
--- a/README
+++ b/README
@@ -7,7 +7,7 @@ For more information, refer to the README files and the following pages:
UPDATE 4th April 2015, by Hieu Hoang:
-Works with most versions of gcc, including really old versions. Doesn't work with recent versions of clang.
+Works with most versions of gcc and clang, including really old versions.
Why not try using mgiza? It's multi-threaded and kept up to date to work with most compilers
https://github.com/moses-smt/mgiza
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++)