@@ -18,20 +18,18 @@ using bool_constant = std::bool_constant<B>;
1818template <bool ... Vals>
1919using bool_sequence = std::integer_sequence<bool , Vals...>;
2020
21-
22- template <typename T, typename U, typename ... Us>
23- struct NBL_API is_any_of : std::integral_constant<bool ,
24- std::conditional<
25- std::is_same<T, U>::value,
26- std::true_type,
27- nbl::is_any_of<T, Us...>
28- >::type::value
29- >
30- {};
31-
32- template <typename T, typename U>
33- struct NBL_API is_any_of<T, U> : std::is_same<T, U>::type { };
34-
21+ template <typename T, typename ... Us>
22+ _INLINE_VAR constexpr bool is_any_of_v = (... || std::is_same<T, Us>::value);
23+
24+ template <typename T, typename ... Us>
25+ struct NBL_API is_any_of : std::integral_constant<bool , is_any_of_v<T, Us...>> {};
26+
27+ static_assert (is_any_of<bool , bool >::value == true , " is_any_of test" );
28+ static_assert (is_any_of<bool , int >::value == false , " is_any_of test" );
29+ static_assert (is_any_of<bool , int , bool >::value == true , " is_any_of test" );
30+ static_assert (is_any_of<bool , int , double >::value == false , " is_any_of test" );
31+ static_assert (is_any_of<bool , int , double , bool >::value == true , " is_any_of test" );
32+ static_assert (is_any_of<bool , int , double , float >::value == false , " is_any_of test" );
3533
3634template <auto cf, decltype (cf) cmp, decltype (cf)... searchtab>
3735struct NBL_API is_any_of_values : is_any_of_values<cf,searchtab...> {};
0 commit comments