From d41e577ba138445c0f6eb8aff74a41c2d2bb63bf Mon Sep 17 00:00:00 2001 From: stasoid Date: Fri, 31 Jan 2025 10:55:32 +0500 Subject: [PATCH] LibIPC: Make Vector concept match AK::Vector with any inline_capacity Also: * Use SpecializationOf for Optional and Variant concepts * Remove inline because it is implied by constexpr * Reorder declarations from less to more specialized (in common sense) --- Libraries/LibIPC/Concepts.h | 67 ++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 38 deletions(-) diff --git a/Libraries/LibIPC/Concepts.h b/Libraries/LibIPC/Concepts.h index 6ddfb51f9ad..3fec999d5f1 100644 --- a/Libraries/LibIPC/Concepts.h +++ b/Libraries/LibIPC/Concepts.h @@ -27,54 +27,45 @@ namespace IPC::Concepts { namespace Detail { +// Cannot use SpecializationOf with these templates because they have non-type parameters. See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1985r3.pdf template -constexpr inline bool IsHashMap = false; -template -constexpr inline bool IsHashMap> = true; - -template -constexpr inline bool IsOptional = false; -template -constexpr inline bool IsOptional> = true; - -template -constexpr inline bool IsSharedSingleProducerCircularQueue = false; -template -constexpr inline bool IsSharedSingleProducerCircularQueue> = true; - -template -constexpr inline bool IsVariant = false; -template -constexpr inline bool IsVariant> = true; - -template -constexpr inline bool IsVector = false; -template -constexpr inline bool IsVector> = true; - -template -constexpr inline bool IsArray = false; +constexpr bool IsArray = false; template -constexpr inline bool IsArray> = true; +constexpr bool IsArray> = true; + +template +constexpr bool IsVector = false; +template +constexpr bool IsVector> = true; + +template +constexpr bool IsHashMap = false; +template +constexpr bool IsHashMap> = true; + +template +constexpr bool IsSharedSingleProducerCircularQueue = false; +template +constexpr bool IsSharedSingleProducerCircularQueue> = true; } template -concept HashMap = Detail::IsHashMap; - -template -concept Optional = Detail::IsOptional; - -template -concept SharedSingleProducerCircularQueue = Detail::IsSharedSingleProducerCircularQueue; - -template -concept Variant = Detail::IsVariant; +concept Array = Detail::IsArray; template concept Vector = Detail::IsVector; template -concept Array = Detail::IsArray; +concept HashMap = Detail::IsHashMap; + +template +concept SharedSingleProducerCircularQueue = Detail::IsSharedSingleProducerCircularQueue; + +template +concept Optional = SpecializationOf; + +template +concept Variant = SpecializationOf; }