From d9cc1a6986188a97e09e4c8cef46c34eee5f9cd2 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Sun, 10 Nov 2013 00:58:44 -0500 Subject: guard against direct includes of tr1 --- utils/hash.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'utils/hash.h') diff --git a/utils/hash.h b/utils/hash.h index 189ed1ae..e56fca06 100644 --- a/utils/hash.h +++ b/utils/hash.h @@ -20,11 +20,17 @@ # define HASH_MAP_RESERVED(h,empty,deleted) do { (h).set_empty_key(empty); (h).set_deleted_key(deleted); } while(0) # define HASH_MAP_EMPTY(h,empty) do { (h).set_empty_key(empty); } while(0) #else +#ifdef HAVE_CXX11 +# include +# include +#else # include # include -# define SPARSE_HASH_MAP std::tr1::unordered_map -# define HASH_MAP std::tr1::unordered_map -# define HASH_SET std::tr1::unordered_set +namespace std { using std::tr1::unordered_map; using std::tr1::unordered_set; } +#endif +# define SPARSE_HASH_MAP std::unordered_map +# define HASH_MAP std::unordered_map +# define HASH_SET std::unordered_set # define HASH_MAP_DELETED(h,deleted) # define HASH_MAP_RESERVED(h,empty,deleted) # define HASH_MAP_EMPTY(h,empty) -- cgit v1.2.3 From 3abb2f590940e05be345446a10e5f247f0046c2a Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Sun, 10 Nov 2013 01:22:11 -0500 Subject: fixes --- configure.ac | 7 ++++++- mteval/mbr_kbest.cc | 2 +- mteval/ns_ter.cc | 2 +- mteval/ter.cc | 2 +- utils/hash.h | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) (limited to 'utils/hash.h') diff --git a/configure.ac b/configure.ac index c3b749e3..e4183c15 100644 --- a/configure.ac +++ b/configure.ac @@ -185,7 +185,12 @@ AC_CHECK_HEADER(google/dense_hash_map, AC_PROG_INSTALL -CPPFLAGS="-DPIC -fPIC $CPPFLAGS -DHAVE_CONFIG_H -DKENLM_MAX_ORDER=6" +CPPFLAGS="-DPIC -fPIC $CXX11_SWITCH $CPPFLAGS -DHAVE_CONFIG_H -DKENLM_MAX_ORDER=6" + +if test "x$HAVE_CXX11" = "x0"; then + CPPFLAGS="$CPPFLAGS -DHAVE_OLD_CPP" +fi + # core cdec stuff AC_CONFIG_FILES([Makefile]) diff --git a/mteval/mbr_kbest.cc b/mteval/mbr_kbest.cc index 787c03bd..76d2c7fc 100644 --- a/mteval/mbr_kbest.cc +++ b/mteval/mbr_kbest.cc @@ -3,7 +3,7 @@ #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include diff --git a/mteval/ns_ter.cc b/mteval/ns_ter.cc index f0d84098..680fb7b4 100644 --- a/mteval/ns_ter.cc +++ b/mteval/ns_ter.cc @@ -4,7 +4,7 @@ #include #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include diff --git a/mteval/ter.cc b/mteval/ter.cc index 9da54306..19b90bbc 100644 --- a/mteval/ter.cc +++ b/mteval/ter.cc @@ -5,7 +5,7 @@ #include #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include diff --git a/utils/hash.h b/utils/hash.h index e56fca06..e1426ffb 100644 --- a/utils/hash.h +++ b/utils/hash.h @@ -20,7 +20,7 @@ # define HASH_MAP_RESERVED(h,empty,deleted) do { (h).set_empty_key(empty); (h).set_deleted_key(deleted); } while(0) # define HASH_MAP_EMPTY(h,empty) do { (h).set_empty_key(empty); } while(0) #else -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include # include #else -- cgit v1.2.3