From b3220cc302ccaa3b0e0859045a83d945f838371a Mon Sep 17 00:00:00 2001 From: Twan van Laarhoven Date: Sat, 3 Jul 2021 23:11:35 +0200 Subject: [PATCH] Add std::hash instance for String (for wxWidgets < 3.1) --- src/util/string.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/util/string.hpp b/src/util/string.hpp index 48020bba..548314f6 100644 --- a/src/util/string.hpp +++ b/src/util/string.hpp @@ -33,6 +33,17 @@ inline wxStdString const& toStdString(String const& s) { #endif } +#if wxVERSION_NUMBER < 3100 +// wxWidgets 3.1.0 added this specialization +namespace std { + template<> struct hash { + size_t operator()(String const& s) const { + return std::hash()(s.ToStdWstring()); + } + }; +} // +#endif + // ----------------------------------------------------------------------------- : Unicode /// u if UNICODE is defined, a otherwise