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] 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{});