From 3b9e3e467abe4a5dea76f9482cbaf9c378908a68 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Krzysztof=20Kosi=C5=84ski?= Date: Tue, 2 Mar 2010 23:52:32 +0100 Subject: [PATCH] Use Boost unordeed containers instead of TR1 to minimize pain when using Apple compilers. --- configure.ac | 21 ------------- src/libnrtype/FontFactory.cpp | 4 +-- src/libnrtype/FontInstance.cpp | 4 +-- src/ui/tool/control-point-selection.h | 6 ++-- src/ui/tool/multi-path-manipulator.cpp | 6 ++-- src/util/hash.h | 41 -------------------------- 6 files changed, 8 insertions(+), 74 deletions(-) delete mode 100644 src/util/hash.h diff --git a/configure.ac b/configure.ac index ca49d5f54..5613f49a8 100644 --- a/configure.ac +++ b/configure.ac @@ -125,27 +125,6 @@ if test "x$GXX" = "xyes"; then fi fi -# Test for broken unordered_set on GCC 4.0.0, shipped with Apple XCode tools -# This is a system header so we check it as soon as possible -AC_MSG_CHECKING([TR1 unordered_set usability]) -AC_COMPILE_IFELSE([ -#include -int main() { - std::tr1::unordered_set i, j; - i = j; - return 0; -} -], [unordered_set_broken=no], [unordered_set_broken=yes]) -if test "x$unordered_set_broken" = "xyes"; then - AC_MSG_RESULT([broken]) - AC_MSG_ERROR([ -You have a broken version of the header. See -http://wiki.inkscape.org/wiki/index.php/HashtableFixOSX -for information on how to fix this problem.]) -else - AC_MSG_RESULT([ok]) -fi - # Test whether GCC emits a spurious warning when using boost::optional # If yes, turn off strict aliasing warnings to reduce noise # and allow the legitimate warnings to stand out diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index 09d9e2c4f..d6fc207b0 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -26,9 +26,9 @@ /* Freetype2 */ # include -#include +#include -typedef std::tr1::unordered_map FaceMapType; +typedef boost::unordered_map FaceMapType; // need to avoid using the size field size_t font_descr_hash::operator()( PangoFontDescription *const &x) const { diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp index 628e3cba0..557e9106e 100644 --- a/src/libnrtype/FontInstance.cpp +++ b/src/libnrtype/FontInstance.cpp @@ -29,7 +29,7 @@ # include FT_TRUETYPE_TABLES_H # include -#include +#include struct font_style_hash : public std::unary_function { @@ -40,7 +40,7 @@ struct font_style_equal : public std::binary_function StyleMap; +typedef boost::unordered_map StyleMap; diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index d982d6bec..dde9ef218 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -13,16 +13,14 @@ #define SEEN_UI_TOOL_NODE_SELECTION_H #include -#include -#include #include +#include #include #include <2geom/forward.h> #include <2geom/point.h> #include <2geom/rect.h> #include "display/display-forward.h" #include "util/accumulators.h" -#include "util/hash.h" #include "ui/tool/commit-events.h" #include "ui/tool/manipulator.h" @@ -42,7 +40,7 @@ class ControlPointSelection : public Manipulator, public sigc::trackable { public: ControlPointSelection(SPDesktop *d, SPCanvasGroup *th_group); ~ControlPointSelection(); - typedef std::tr1::unordered_set< SelectableControlPoint * > set_type; + typedef boost::unordered_set< SelectableControlPoint * > set_type; typedef set_type Set; // convenience alias typedef set_type::iterator iterator; diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index 5d7b520c8..f5646ac36 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -8,7 +8,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include +#include #include #include #include @@ -25,15 +25,13 @@ #include "ui/tool/multi-path-manipulator.h" #include "ui/tool/path-manipulator.h" -namespace std { using namespace tr1; } - namespace Inkscape { namespace UI { namespace { typedef std::pair IterPair; typedef std::vector IterPairList; -typedef std::unordered_set IterSet; +typedef boost::unordered_set IterSet; typedef std::multimap DistanceMap; typedef std::pair DistanceMapItem; diff --git a/src/util/hash.h b/src/util/hash.h deleted file mode 100644 index d5abeff5a..000000000 --- a/src/util/hash.h +++ /dev/null @@ -1,41 +0,0 @@ -/** @file - * Hash function for various things - */ -/* Authors: - * Krzysztof Kosiński - * - * Copyright (C) 2009 Authors - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#ifndef SEEN_UTIL_HASH_H -#define SEEN_UTIL_HASH_H - -#include - -namespace std { -namespace tr1 { - -/** Hash function for Boost shared pointers */ -template -struct hash< boost::shared_ptr > : public std::unary_function, size_t> { - size_t operator()(boost::shared_ptr p) const { - return reinterpret_cast(p.get()); - } -}; - -} // namespace tr1 -} // namespace std - -#endif - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : -- 2.30.2