diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-03-24 18:10:30 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-03-24 18:11:46 +0000 |
commit | ae99a2124da32e4d2474e6dc6cf54322b688b743 (patch) | |
tree | 2f447bf5aaae5b13038e04b8d5d154d802775ec3 /lib | |
parent | Add Renderable typed collection to GameState worldObjects (diff) | |
download | ilt-ae99a2124da32e4d2474e6dc6cf54322b688b743.tar.bz2 ilt-ae99a2124da32e4d2474e6dc6cf54322b688b743.tar.xz ilt-ae99a2124da32e4d2474e6dc6cf54322b688b743.zip |
Use is_base_of_v instead of is_convertible_v to choose OtherObjects
Diffstat (limited to 'lib')
-rw-r--r-- | lib/collection.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/collection.h b/lib/collection.h index b786e2f..8e9cf1a 100644 --- a/lib/collection.h +++ b/lib/collection.h @@ -236,12 +236,12 @@ protected: } template<typename T> - requires((std::is_convertible_v<T *, Others *> || ...)) + requires((std::is_base_of_v<Others, T> || ...)) [[nodiscard]] consteval static bool idx() { size_t typeIdx = 0; - return ((typeIdx++ && std::is_convertible_v<Others *, T *>) || ...); + return ((typeIdx++ && std::is_base_of_v<Others, T>) || ...); } template<typename T> @@ -249,7 +249,7 @@ protected: constexpr const auto & containerFor() const { - if constexpr ((std::is_convertible_v<T *, Others *> || ...)) { + if constexpr ((std::is_base_of_v<Others, T> || ...)) { return std::get<idx<T>()>(otherObjects); } else { |