From 002c1280a5760683aae6ff4beee85958b33af5f7 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Wed, 17 Jun 2020 18:50:19 +0200 Subject: [PATCH] simplify is_in trait --- alib2std/src/extensions/type_traits.hpp | 35 +------------------------ 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/alib2std/src/extensions/type_traits.hpp b/alib2std/src/extensions/type_traits.hpp index d059f06427..fa1f9f6595 100644 --- a/alib2std/src/extensions/type_traits.hpp +++ b/alib2std/src/extensions/type_traits.hpp @@ -96,40 +96,7 @@ namespace ext { * \tparam Ts ... the types pack to look in */ template < typename T, typename ... Ts > - struct is_in; - - /** - * \brief - * Trait to test whether type T is in a types pack. The trait provides field value set to true if the type T is in pack of types Ts ..., false othervise. - * - * Specialisation for empty pack, in which case the field is set to false. - * - * \tparam T the type to look for - */ - template < typename T > - struct is_in < T > : std::false_type { }; - - /** - * \brief - * Trait to test whether type T is in a types pack. The trait provides field value set to true if the type T is in pack of types Ts ..., false othervise. - * - * Specialisation for non-empty pack where the first type in the pack is different from the tested type, in which case the field is set to result of the recursive test on shorter pack. - * - * \tparam T the type to look for - */ - template < typename T, typename U, typename ... Ts > - struct is_in < T, U, Ts ... > : is_in < T, Ts ... > { }; - - /** - * \brief - * Trait to test whether type T is in a types pack. The trait provides field value set to true if the type T is in pack of types Ts ..., false othervise. - * - * Specialisation for non-empty pack where the first type in the pack is the same as the tested type, in which case the field is set to true. - * - * \tparam T the type to look for - */ - template < typename T, typename ... Ts > - struct is_in < T, T, Ts ... > : std::true_type { }; + using is_in = std::integral_constant < bool, ( std::is_same < T, Ts >::value || ... ) >; // ---------------------------------------------------------------------------------------------------- -- GitLab