From 00b932d71984991c6d79875478fc25af172b7bc1 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 25 Mar 2025 02:59:04 +0000 Subject: Fix lookup idx for otherObjects suitable for T --- lib/collection.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/collection.h b/lib/collection.h index 8e9cf1a..b7d7d81 100644 --- a/lib/collection.h +++ b/lib/collection.h @@ -237,11 +237,12 @@ protected: template requires((std::is_base_of_v || ...)) - [[nodiscard]] consteval static bool + [[nodiscard]] consteval static size_t idx() { size_t typeIdx = 0; - return ((typeIdx++ && std::is_base_of_v) || ...); + auto found = ((++typeIdx && std::is_base_of_v) || ...); + return typeIdx - found; } template -- cgit v1.2.3