mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
AK: Add the concept of hash-compatible types
This commit is contained in:
committed by
Ali Mohammad Pur
parent
92e824afa1
commit
c8bee92fb9
@@ -36,6 +36,9 @@ concept SameAs = IsSame<T, U>;
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
concept AnyString = Detail::IsConstructible<StringView, T>;
|
concept AnyString = Detail::IsConstructible<StringView, T>;
|
||||||
|
|
||||||
|
template<typename T, typename U>
|
||||||
|
concept HashCompatible = IsHashCompatible<Detail::Decay<T>, Detail::Decay<U>>;
|
||||||
|
|
||||||
// FIXME: remove once Clang formats these properly.
|
// FIXME: remove once Clang formats these properly.
|
||||||
// clang-format off
|
// clang-format off
|
||||||
template<typename Func, typename... Args>
|
template<typename Func, typename... Args>
|
||||||
|
|||||||
@@ -575,6 +575,12 @@ using Decay = typename __decay<T>::type;
|
|||||||
|
|
||||||
template<typename T, typename U>
|
template<typename T, typename U>
|
||||||
inline constexpr bool IsPointerOfType = IsPointer<Decay<U>>&& IsSame<T, RemoveCV<RemovePointer<Decay<U>>>>;
|
inline constexpr bool IsPointerOfType = IsPointer<Decay<U>>&& IsSame<T, RemoveCV<RemovePointer<Decay<U>>>>;
|
||||||
|
|
||||||
|
template<typename T, typename U>
|
||||||
|
inline constexpr bool IsHashCompatible = false;
|
||||||
|
template<typename T>
|
||||||
|
inline constexpr bool IsHashCompatible<T, T> = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
using AK::Detail::AddConst;
|
using AK::Detail::AddConst;
|
||||||
using AK::Detail::AddLvalueReference;
|
using AK::Detail::AddLvalueReference;
|
||||||
@@ -605,6 +611,7 @@ using AK::Detail::IsEnum;
|
|||||||
using AK::Detail::IsFloatingPoint;
|
using AK::Detail::IsFloatingPoint;
|
||||||
using AK::Detail::IsFunction;
|
using AK::Detail::IsFunction;
|
||||||
using AK::Detail::IsFundamental;
|
using AK::Detail::IsFundamental;
|
||||||
|
using AK::Detail::IsHashCompatible;
|
||||||
using AK::Detail::IsIntegral;
|
using AK::Detail::IsIntegral;
|
||||||
using AK::Detail::IsLvalueReference;
|
using AK::Detail::IsLvalueReference;
|
||||||
using AK::Detail::IsMoveAssignable;
|
using AK::Detail::IsMoveAssignable;
|
||||||
|
|||||||
@@ -7,10 +7,16 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <AK/Concepts.h>
|
||||||
#include <AK/Forward.h>
|
#include <AK/Forward.h>
|
||||||
|
|
||||||
namespace AK {
|
namespace AK {
|
||||||
|
|
||||||
|
namespace Detail {
|
||||||
|
template<Concepts::AnyString T, Concepts::AnyString U>
|
||||||
|
inline constexpr bool IsHashCompatible<T, U> = true;
|
||||||
|
}
|
||||||
|
|
||||||
enum class CaseSensitivity {
|
enum class CaseSensitivity {
|
||||||
CaseInsensitive,
|
CaseInsensitive,
|
||||||
CaseSensitive,
|
CaseSensitive,
|
||||||
|
|||||||
Reference in New Issue
Block a user