diff --git a/AK/Traits.h b/AK/Traits.h index 6d90fb0733b..b1d60f325f7 100644 --- a/AK/Traits.h +++ b/AK/Traits.h @@ -9,6 +9,8 @@ #include #include #include +#include +#include namespace AK { @@ -37,7 +39,7 @@ requires(IsIntegral) struct Traits : public GenericTraits { }; template -requires(IsPointer) struct Traits : public GenericTraits { +requires(IsPointer && !Detail::IsPointerOfType) struct Traits : public GenericTraits { static unsigned hash(T p) { return ptr_hash((FlatPtr)p); } static constexpr bool is_trivial() { return true; } }; @@ -48,6 +50,13 @@ struct Traits : public GenericTraits { static constexpr bool is_trivial() { return Traits>::is_trivial(); } }; +template +requires(Detail::IsPointerOfType) struct Traits : public GenericTraits { + static unsigned hash(T const value) { return string_hash(value, strlen(value)); } + static constexpr bool equals(T const a, T const b) { return strcmp(a, b); } + static constexpr bool is_trivial() { return true; } +}; + } using AK::GenericTraits;