Define "template<> struct hash<wxString>" in Kicad only if wxWidgets version < 3.1.0, because it is already defined in 3.1.0

This commit is contained in:
jean-pierre charras 2017-12-18 09:53:14 +01:00
parent 9d4bfbded8
commit 1f78de409f
2 changed files with 9 additions and 2 deletions

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2014-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
* 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<wxString>::operator()( const wxString& s ) const
{
return std::hash<std::wstring>{}( s.ToStdWstring() );
}
#endif

View File

@ -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_