Implemented std::hash<wxString> specialization
Thanks to that wxString objects can be stored in certain STL containers, e.g. unordered_map.
This commit is contained in:
parent
124c82f1cf
commit
812b8b081d
|
@ -363,3 +363,9 @@ wxString GetOSXKicadDataDir()
|
|||
return ddir.GetPath();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
size_t std::hash<wxString>::operator()( const wxString& s ) const
|
||||
{
|
||||
return std::hash<std::wstring>{}( s.ToStdWstring() );
|
||||
}
|
||||
|
|
|
@ -337,4 +337,13 @@ wxString GetOSXKicadMachineDataDir();
|
|||
wxString GetOSXKicadDataDir();
|
||||
#endif
|
||||
|
||||
///> Template specialization to enable wxStrings for certain containers (e.g. unordered_map)
|
||||
namespace std
|
||||
{
|
||||
template<> struct hash<wxString>
|
||||
{
|
||||
size_t operator()( const wxString& s ) const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // INCLUDE__COMMON_H_
|
||||
|
|
Loading…
Reference in New Issue