Fix missing definition of std::hash<wxPoint> when using wxWidgets 3.1.x

it was not compiled for wxWidgets 3.1.x, but it does not exist in 3.1.x
This commit is contained in:
jean-pierre charras 2019-03-14 16:34:05 +01:00
parent 353d9d7c9e
commit a1ee5405aa
2 changed files with 21 additions and 8 deletions

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014-2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
@ -167,12 +167,12 @@ void SelectReferenceNumber( wxTextEntry* aTextEntry )
{
wxString num = ref;
while( !num.IsEmpty() && ( !wxIsdigit( num.Last() ) || !wxIsdigit( num.GetChar( 0 ) ) ) )
while( !num.IsEmpty() && ( !isdigit( num.Last() ) || !isdigit( num.GetChar( 0 ) ) ) )
{
if( !wxIsdigit( num.Last() ) )
if( !isdigit( num.Last() ) )
num.RemoveLast();
if( !wxIsdigit( num.GetChar ( 0 ) ) )
if( !isdigit( num.GetChar ( 0 ) ) )
num = num.Right( num.Length() - 1);
}
@ -591,8 +591,13 @@ size_t std::hash<wxString>::operator()( const wxString& s ) const
}
#endif
#ifdef USE_KICAD_WXPOINT_LESS_AND_HASH
size_t std::hash<wxPoint>::operator() ( const wxPoint& k ) const
{
return ( ( std::hash<int>()( k.x )
^ ( std::hash<int>()( k.y ) << 1 ) ) >> 1 );
}
#ifdef USE_KICAD_WXPOINT_LESS
bool std::less<wxPoint>::operator()( const wxPoint& aA, const wxPoint& aB ) const
{
if( aA.x == aB.x )

View File

@ -1,10 +1,10 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014-2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2007-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2019 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
@ -376,7 +376,15 @@ namespace std
#endif
/// Required to use wxPoint as key type in maps
#define USE_KICAD_WXPOINT_LESS // for common.cpp
#define USE_KICAD_WXPOINT_LESS_AND_HASH // for common.cpp
namespace std
{
template <> struct hash<wxPoint>
{
size_t operator() ( const wxPoint& k ) const;
};
}
namespace std
{
template<> struct less<wxPoint>