diff --git a/common/common.cpp b/common/common.cpp index cb62cf8dc7..2245ca433b 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2014-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008-2015 Wayne Stambaugh - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -364,8 +364,10 @@ wxString GetOSXKicadDataDir() } #endif - +// add this only if it is not in wxWidgets (for instance before 3.1.0) +#ifdef USE_KICAD_WXSTRING_HASH size_t std::hash::operator()( const wxString& s ) const { return std::hash{}( s.ToStdWstring() ); } +#endif diff --git a/include/common.h b/include/common.h index ad59b3338a..2f821ee538 100644 --- a/include/common.h +++ b/include/common.h @@ -337,6 +337,10 @@ wxString GetOSXKicadMachineDataDir(); wxString GetOSXKicadDataDir(); #endif +// Some wxWidgets versions (for instance before 3.1.0) do not include +// this function, so add it if missing +#if !wxCHECK_VERSION( 3, 1, 0 ) +#define USE_KICAD_WXSTRING_HASH // for common.cpp ///> Template specialization to enable wxStrings for certain containers (e.g. unordered_map) namespace std { @@ -345,5 +349,6 @@ namespace std size_t operator()( const wxString& s ) const; }; } +#endif #endif // INCLUDE__COMMON_H_