diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-03-25 02:59:04 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-03-25 02:59:04 +0000 |
commit | 00b932d71984991c6d79875478fc25af172b7bc1 (patch) | |
tree | 55d55c36d29e335b3f0c2a5c0ff69d4b4c9eaf23 | |
parent | Use is_base_of_v instead of is_convertible_v to choose OtherObjects (diff) | |
download | ilt-00b932d71984991c6d79875478fc25af172b7bc1.tar.bz2 ilt-00b932d71984991c6d79875478fc25af172b7bc1.tar.xz ilt-00b932d71984991c6d79875478fc25af172b7bc1.zip |
Fix lookup idx for otherObjects suitable for T
-rw-r--r-- | lib/collection.h | 5 |
1 files 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<typename T> requires((std::is_base_of_v<Others, T> || ...)) - [[nodiscard]] consteval static bool + [[nodiscard]] consteval static size_t idx() { size_t typeIdx = 0; - return ((typeIdx++ && std::is_base_of_v<Others, T>) || ...); + auto found = ((++typeIdx && std::is_base_of_v<Others, T>) || ...); + return typeIdx - found; } template<typename T> |