Add support for msvc:/Zc:wchar_t-

This commit is contained in:
Andrew Dean
2021-09-02 12:19:53 -07:00
parent 1f2671ff0a
commit 7976ede849
2 changed files with 9 additions and 0 deletions
+7
View File
@@ -338,6 +338,13 @@
#define PHMAP_INTERNAL_MSVC_2017_DBG_MODE #define PHMAP_INTERNAL_MSVC_2017_DBG_MODE
#endif #endif
// ---------------------------------------------------------------------------
// Checks whether wchar_t is treated as a native type
// (MSVC: /Zc:wchar_t- treats wchar_t as unsigned short)
// ---------------------------------------------------------------------------
#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
#define PHMAP_HAS_NATIVE_WCHAR_T
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Sanitizer Attributes // Sanitizer Attributes
+2
View File
@@ -209,12 +209,14 @@ struct Hash<unsigned char> : public phmap_unary_function<unsigned char, size_t>
{ return static_cast<size_t>(val); } { return static_cast<size_t>(val); }
}; };
#ifdef PHMAP_HAS_NATIVE_WCHAR_T
template <> template <>
struct Hash<wchar_t> : public phmap_unary_function<wchar_t, size_t> struct Hash<wchar_t> : public phmap_unary_function<wchar_t, size_t>
{ {
inline size_t operator()(wchar_t val) const noexcept inline size_t operator()(wchar_t val) const noexcept
{ return static_cast<size_t>(val); } { return static_cast<size_t>(val); }
}; };
#endif
template <> template <>
struct Hash<int16_t> : public phmap_unary_function<int16_t, size_t> struct Hash<int16_t> : public phmap_unary_function<int16_t, size_t>