From 97d68d31e8ffaca1d742f247cff45c00badf257d Mon Sep 17 00:00:00 2001 From: Patrick Wuttke Date: Wed, 19 Jul 2023 22:51:37 +0200 Subject: [PATCH] Added is_type_member to check if a type is inside a variant or similar types. --- source/mijin/util/traits.hpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source/mijin/util/traits.hpp b/source/mijin/util/traits.hpp index dfe4303..78d8011 100644 --- a/source/mijin/util/traits.hpp +++ b/source/mijin/util/traits.hpp @@ -39,8 +39,6 @@ struct always_false_val template inline constexpr bool always_false_val_v = always_false_val::value; - - template typename TFilter, typename... TArgs> struct TypeFilter; @@ -103,6 +101,17 @@ struct is_any_type : std::disjunction...> {}; template static constexpr bool is_any_type_v = is_any_type::value; +template +struct is_type_member; + +template typename TCollection, typename... Ts> +struct is_type_member> + : std::bool_constant<(... || std::is_same{})> +{}; + +template +constexpr bool is_type_member_v = is_type_member::value; + // // public functions //