From 18a9be8a2ce3c201af37a3a6740e8f68b74b605f Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Wed, 4 Dec 2024 11:57:29 +0100 Subject: [PATCH 1/3] DPL: Simplify prune_voids_pack Use the requirements directly on the template arguments. --- Framework/Foundation/include/Framework/Pack.h | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Framework/Foundation/include/Framework/Pack.h b/Framework/Foundation/include/Framework/Pack.h index 2355ffed6b35b..78511876917b2 100644 --- a/Framework/Foundation/include/Framework/Pack.h +++ b/Framework/Foundation/include/Framework/Pack.h @@ -114,42 +114,44 @@ consteval auto prune_voids_pack(Result result, pack<>) return result; } +template +concept void_pack_element = std::is_void_v; + +template +concept nonvoid_pack_element = !void_pack_element; + + // The first one is non void, but one of the others is void -template - requires(!std::is_void_v) +template consteval auto prune_voids_pack(pack result, pack) { return prune_voids_pack(pack{}, pack{}); } // The first one is void -template - requires(std::is_void_v) +template consteval auto prune_voids_pack(pack result, pack) { return prune_voids_pack(pack{}, pack{}); } // The first one is non void, but one of the others is void -template - requires(!std::is_void_v && !std::is_void_v) +template consteval auto prune_voids_pack(pack result, pack) { return prune_voids_pack(pack{}, pack{}); } // Eats 4 types at the time -template - requires(!std::is_void_v && !std::is_void_v && !std::is_void_v && !std::is_void_v) +template consteval auto prune_voids_pack(pack result, pack) { return prune_voids_pack(pack{}, pack{}); } // Eats 8 types at the time -template - requires(!std::is_void_v && !std::is_void_v && !std::is_void_v && !std::is_void_v && !std::is_void_v && !std::is_void_v && !std::is_void_v && !std::is_void_v) +template consteval auto prune_voids_pack(pack result, pack) { return prune_voids_pack(pack{}, pack{}); From e089b2ffab660169828c25fc529f00bb2fbf0a89 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Wed, 4 Dec 2024 12:11:30 +0100 Subject: [PATCH 2/3] DPL: use constraints directly on arguments in place of requires --- Framework/Foundation/include/Framework/Endian.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Framework/Foundation/include/Framework/Endian.h b/Framework/Foundation/include/Framework/Endian.h index a8fee915ee340..3df7912cb093a 100644 --- a/Framework/Foundation/include/Framework/Endian.h +++ b/Framework/Foundation/include/Framework/Endian.h @@ -35,22 +35,19 @@ template - requires std::same_as -inline uint16_t doSwap(uint16_t x) +inline uint16_t doSwap(std::same_as auto x) { return swap16_(x); } template - requires std::same_as -inline uint32_t doSwap(uint32_t x) +inline uint32_t doSwap(std::same_as auto x) { return swap32_(x); } template - requires std::same_as -inline uint64_t doSwap(uint64_t x) +inline uint64_t doSwap(std::same_as auto x) { return swap64_(x); } From da789926eb718c1ba69aa075346ca5ecd6c34b3b Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 4 Dec 2024 11:13:28 +0000 Subject: [PATCH 3/3] Please consider the following formatting changes --- Framework/Foundation/include/Framework/Endian.h | 1 - Framework/Foundation/include/Framework/Pack.h | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Framework/Foundation/include/Framework/Endian.h b/Framework/Foundation/include/Framework/Endian.h index 3df7912cb093a..5b69591030249 100644 --- a/Framework/Foundation/include/Framework/Endian.h +++ b/Framework/Foundation/include/Framework/Endian.h @@ -33,7 +33,6 @@ #define O2_BIG_ENDIAN __BIG_ENDIAN #define O2_LITTLE_ENDIAN __LITTLE_ENDIAN - template inline uint16_t doSwap(std::same_as auto x) { diff --git a/Framework/Foundation/include/Framework/Pack.h b/Framework/Foundation/include/Framework/Pack.h index 78511876917b2..4fcf796a3ec62 100644 --- a/Framework/Foundation/include/Framework/Pack.h +++ b/Framework/Foundation/include/Framework/Pack.h @@ -114,13 +114,12 @@ consteval auto prune_voids_pack(Result result, pack<>) return result; } -template +template concept void_pack_element = std::is_void_v; -template +template concept nonvoid_pack_element = !void_pack_element; - // The first one is non void, but one of the others is void template consteval auto prune_voids_pack(pack result, pack)