From 8d9eee83203dfc7177cd8639c14a5c809085698d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 10 Feb 2012 10:22:45 +0000 Subject: [PATCH] Fix wxHash{Set,Map} compilation with g++ 4.7 in C++11 mode. Fully qualify the hasher and comparator classes used with WX_DECLARE_HASH_{SET,MAP} macros as they're used as base classes by the standard library implementation in g++ 4.7 and using them without the scope operator results in compilation errors because they're interpreted as being (inaccessible) base classes and not the global ones. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70556 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/html/htmlpars.h | 2 +- interface/wx/hashmap.h | 8 ++++---- interface/wx/hashset.h | 14 +++++++------- src/common/translation.cpp | 2 +- src/generic/grid.cpp | 2 +- src/xrc/xmlres.cpp | 2 +- utils/wxrc/wxrc.cpp | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/wx/html/htmlpars.h b/include/wx/html/htmlpars.h index 045060a4ea..cecb016c3f 100644 --- a/include/wx/html/htmlpars.h +++ b/include/wx/html/htmlpars.h @@ -29,7 +29,7 @@ class wxHtmlTextPieces; class wxHtmlParserState; WX_DECLARE_HASH_SET_WITH_DECL_PTR(wxHtmlTagHandler*, - wxPointerHash, wxPointerEqual, + ::wxPointerHash, ::wxPointerEqual, wxHtmlTagHandlersSet, class WXDLLIMPEXP_HTML); WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxHtmlTagHandler*, diff --git a/interface/wx/hashmap.h b/interface/wx/hashmap.h index c103e44afa..6364471596 100644 --- a/interface/wx/hashmap.h +++ b/interface/wx/hashmap.h @@ -83,8 +83,8 @@ @code WX_DECLARE_HASH_MAP( int, wxString, - wxIntegerHash, - wxIntegerEqual, + ::wxIntegerHash, + ::wxIntegerEqual, MyHash ); // using an user-defined class for keys @@ -119,8 +119,8 @@ WX_DECLARE_HASH_MAP( MyKey, // type of the keys SOME_TYPE, // any type you like - MyKeyHash, // hasher - MyKeyEqual, // key equality predicate + ::MyKeyHash, // hasher + ::MyKeyEqual, // key equality predicate CLASSNAME); // name of the class @endcode diff --git a/interface/wx/hashset.h b/interface/wx/hashset.h index 36469e47e5..a3406431c7 100644 --- a/interface/wx/hashset.h +++ b/interface/wx/hashset.h @@ -20,11 +20,11 @@ class MyClass { ... }; // same, with MyClass* keys (only uses pointer equality!) - WX_DECLARE_HASH_SET( MyClass*, wxPointerHash, wxPointerEqual, MySet1 ); + WX_DECLARE_HASH_SET( MyClass*, ::wxPointerHash, ::wxPointerEqual, MySet1 ); // same, with int keys - WX_DECLARE_HASH_SET( int, wxIntegerHash, wxIntegerEqual, MySet2 ); + WX_DECLARE_HASH_SET( int, ::wxIntegerHash, ::wxIntegerEqual, MySet2 ); // declare a hash set with string keys - WX_DECLARE_HASH_SET( wxString, wxStringHash, wxStringEqual, MySet3 ); + WX_DECLARE_HASH_SET( wxString, ::wxStringHash, ::wxStringEqual, MySet3 ); MySet1 h1; MySet2 h1; @@ -70,8 +70,8 @@ @code WX_DECLARE_HASH_SET( int, - wxIntegerHash, - wxIntegerEqual, + ::wxIntegerHash, + ::wxIntegerEqual, MySet ); // using an user-defined class for keys @@ -105,8 +105,8 @@ }; WX_DECLARE_HASH_SET( MyKey, // type of the keys - MyKeyHash, // hasher - MyKeyEqual, // key equality predicate + ::MyKeyHash, // hasher + ::MyKeyEqual, // key equality predicate CLASSNAME); // name of the class @endcode diff --git a/src/common/translation.cpp b/src/common/translation.cpp index ae01cce210..ea6d25955b 100644 --- a/src/common/translation.cpp +++ b/src/common/translation.cpp @@ -1440,7 +1440,7 @@ wxString wxTranslations::ChooseLanguageForDomain(const wxString& WXUNUSED(domain namespace { -WX_DECLARE_HASH_SET(wxString, wxStringHash, wxStringEqual, +WX_DECLARE_HASH_SET(wxString, ::wxStringHash, ::wxStringEqual, wxLocaleUntranslatedStrings); } diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index a1393a0917..37ee7707ee 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -72,7 +72,7 @@ const char wxGridNameStr[] = "grid"; // Required for wxIs... functions #include -WX_DECLARE_HASH_SET_WITH_DECL_PTR(int, wxIntegerHash, wxIntegerEqual, +WX_DECLARE_HASH_SET_WITH_DECL_PTR(int, ::wxIntegerHash, ::wxIntegerEqual, wxGridFixedIndicesSet, class WXDLLIMPEXP_ADV); diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index 55ae02d4d3..fe712f89d5 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -107,7 +107,7 @@ class wxXmlResourceDataRecords : public wxVector // this is a class so that it can be forward-declared }; -WX_DECLARE_HASH_SET_PTR(int, wxIntegerHash, wxIntegerEqual, wxHashSetInt); +WX_DECLARE_HASH_SET_PTR(int, ::wxIntegerHash, ::wxIntegerEqual, wxHashSetInt); class wxIdRange // Holds data for a particular rangename { diff --git a/utils/wxrc/wxrc.cpp b/utils/wxrc/wxrc.cpp index 1998c76687..d6b9799e92 100644 --- a/utils/wxrc/wxrc.cpp +++ b/utils/wxrc/wxrc.cpp @@ -32,7 +32,7 @@ #include "wx/mimetype.h" #include "wx/vector.h" -WX_DECLARE_HASH_SET(wxString, wxStringHash, wxStringEqual, StringSet); +WX_DECLARE_HASH_SET(wxString, ::wxStringHash, ::wxStringEqual, StringSet); class XRCWidgetData { -- 2.45.2