1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-15 15:49:36 +02:00

lib-strings: Make hashing compatible with wx3.0

3.0 doesn't have direct wxString hash support yet, so lift an earlier
version of this from the history, which was used in TranslatableString.h
before and use it again. wxWidgets version is slightly different though.

Signed-off-by: Mart Raudsepp <leio@gentoo.org>
This commit is contained in:
Mart Raudsepp 2021-07-18 14:05:30 +03:00
parent f6b0cd343c
commit c8db3ab3ac
2 changed files with 15 additions and 0 deletions

View File

@ -90,6 +90,20 @@ inline bool operator <= ( const Identifier &x, const Identifier &y )
inline bool operator >= ( const Identifier &x, const Identifier &y )
{ return !(x < y); }
#if !wxCHECK_VERSION(3, 1, 0)
namespace std
{
template<> struct hash< wxString > {
size_t operator () (const wxString &str) const // noexcept
{
auto stdstr = str.ToStdWstring(); // no allocations, a cheap fetch
using Hasher = hash< decltype(stdstr) >;
return Hasher{}( stdstr );
}
};
}
#endif
namespace std
{
template<> struct hash< Identifier > {

View File

@ -18,6 +18,7 @@
class Identifier;
#include <vector>
#include "Identifier.h"
//! Holds a msgid for the translation catalog; may also bind format arguments
/*!