From fa70c0e286d268ef3e35f2d08a0404dcbf02caa3 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 4 Aug 2016 20:01:10 +0100 Subject: Use C++11 unordered containers (bzr r15040) --- configure.ac | 34 ------------------------------ src/util/unordered-containers.h | 46 +++++------------------------------------ 2 files changed, 5 insertions(+), 75 deletions(-) diff --git a/configure.ac b/configure.ac index 603cd6ac1..e57f63885 100644 --- a/configure.ac +++ b/configure.ac @@ -652,40 +652,6 @@ PKG_CHECK_MODULES(INKSCAPE, pangoft2 >= 1.24 ) -# Detect a working version of unordered containers. -# First try looking for native support (C++11 feature) -AC_MSG_CHECKING([native support for unordered_set]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], -[[ - std::unordered_set i, j; - i = j; -]])], -[native_unordered_set_works=yes], [native_unordered_set_works=no]) - -if test "x$native_unordered_set_works" = "xyes"; then - AC_MSG_RESULT([ok]) - AC_DEFINE(HAVE_NATIVE_UNORDERED_SET, 1, [Has working native unordered_set]) -else - AC_MSG_RESULT([not working]) -fi - -AC_MSG_CHECKING([TR1 unordered_set usability]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], -[[ - std::tr1::unordered_set i, j; - i = j; -]])], -[tr1_unordered_set_works=yes], [tr1_unordered_set_works=no]) - -if test "x$tr1_unordered_set_works" = "xyes"; then - AC_MSG_RESULT([ok]) - AC_DEFINE(HAVE_TR1_UNORDERED_SET, 1, [Has working standard TR1 unordered_set]) -else - AC_MSG_RESULT([not working]) -fi - -AC_CHECK_HEADER([boost/unordered_set.hpp], [AC_DEFINE(HAVE_BOOST_UNORDERED_SET, 1, [Boost unordered_set (Boost >= 1.36)])], []) - ink_spell_pkg= if pkg-config --exists gtkspell-3.0; then ink_spell_pkg=gtkspell-3.0 diff --git a/src/util/unordered-containers.h b/src/util/unordered-containers.h index b92f2e7ea..0bda8191f 100644 --- a/src/util/unordered-containers.h +++ b/src/util/unordered-containers.h @@ -20,12 +20,11 @@ #ifndef DOXYGEN_SHOULD_SKIP_THIS -#if defined(HAVE_NATIVE_UNORDERED_SET) -# include -# include -# define INK_UNORDERED_SET std::unordered_set -# define INK_UNORDERED_MAP std::unordered_map -# define INK_HASH std::hash +#include +#include +#define INK_UNORDERED_SET std::unordered_set +#define INK_UNORDERED_MAP std::unordered_map +#define INK_HASH std::hash namespace std { template <> @@ -36,41 +35,6 @@ struct hash : public std::unary_function -# include -# define INK_UNORDERED_SET std::tr1::unordered_set -# define INK_UNORDERED_MAP std::tr1::unordered_map -# define INK_HASH std::tr1::hash - -namespace std { -namespace tr1 { -template <> -struct hash : public std::unary_function { - std::size_t operator()(Glib::ustring const &s) const { - return hash()(s.raw()); - } -}; -} // namespace tr1 -} // namespace std - -#elif defined(HAVE_BOOST_UNORDERED_SET) -# include -# include -# define INK_UNORDERED_SET boost::unordered_set -# define INK_UNORDERED_MAP boost::unordered_map -# define INK_HASH boost::hash - -namespace boost { -template <> -struct hash : public std::unary_function { - std::size_t operator()(Glib::ustring const &s) const { - return hash()(s.raw()); - } -}; -} // namespace boost -#endif - #else /// Name (with namespace) of the unordered set template. #define INK_UNORDERED_SET -- cgit v1.2.3