diff --git a/AK/DistinctNumeric.h b/AK/DistinctNumeric.h index 4625634b268..7fcf62186b7 100644 --- a/AK/DistinctNumeric.h +++ b/AK/DistinctNumeric.h @@ -26,6 +26,7 @@ #pragma once +#include #include namespace AK { @@ -64,9 +65,9 @@ namespace AK { * There are many more operators that do not make sense for numerical types, * or cannot be overloaded in the first place. Naturally, they are not implemented. */ -template +template class DistinctNumeric { - using Self = DistinctNumeric; + using Self = DistinctNumeric; public: DistinctNumeric(T value) @@ -301,8 +302,14 @@ private: } #define TYPEDEF_DISTINCT_NUMERIC_GENERAL(T, Incr, Cmp, Bool, Flags, Shift, Arith, NAME) \ - using NAME = DistinctNumeric; + using NAME = DistinctNumeric; #define TYPEDEF_DISTINCT_ORDERED_ID(T, NAME) TYPEDEF_DISTINCT_NUMERIC_GENERAL(T, false, true, true, false, false, false, NAME) // TODO: Further type aliases? +template +struct AK::Traits> : public AK::GenericTraits> { + static constexpr bool is_trivial() { return true; } + static constexpr auto hash(const AK::DistinctNumeric& d) { return AK::Traits::hash(d.value()); } +}; + using AK::DistinctNumeric;