Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filter over types in TSS_CASE_TPL #101

Open
jfalcou opened this issue Oct 15, 2024 · 1 comment
Open

Add filter over types in TSS_CASE_TPL #101

jfalcou opened this issue Oct 15, 2024 · 1 comment

Comments

@jfalcou
Copy link
Owner

jfalcou commented Oct 15, 2024

@jfalcou - can you implement filter? or what do you think?

@SadiinsoSnowfall
Copy link
Contributor

// filter types with predicate
   template<template<typename> typename Pred, typename Type> struct filter
   {
     template<typename... Ls> static constexpr types<Ls...> tuple_to_types(const std::tuple<Ls...>&);
     template<typename T>
     static constexpr std::conditional_t<Pred<T>::value, std::tuple<T>, std::tuple<>> filter_type();

     template<typename... Ls> static constexpr auto filter_impl(types<Ls...>)
     {
       return tuple_to_types(std::tuple_cat(filter_type<Ls>()...));
     }
     using type = decltype(filter_impl(Type {}));
   };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants