Filters a product type over a predicate.
- Template Parameters
-
| Pred | Compile-time predicate |
- Parameters
-
- Returns
- A Product type containing all values which types satisfies
Pred.
Helper type
{
template<
template<
typename>
typename Pred, kumi::product_type T>
struct filter;
template<template<typename> typename Pred, kumi::product_type T>
using filter_t = typename filter<Pred, T>::type;
}
constexpr auto filter(T &&t) noexcept
Filters a product type over a predicate.
Definition partition.hpp:102
Main KUMI namespace.
Definition algorithm.hpp:11
Computes the type returned by a call to kumi::filter.
Example:
#include <kumi/kumi.hpp>
#include <type_traits>
#include <iostream>
int main()
{
int a = 4;
double b = 3.1415;
float c = 0.01f;
auto original =
kumi::tuple{a,&a,b,&b,c,&c,
'z',
nullptr};
std::cout << original << "\n";
std::cout << "Pointers : " << kumi::filter<std::is_pointer>(original) << "\n";
std::cout << "Real : " << kumi::filter<std::is_floating_point>(original) << "\n";
std::cout << "nullptr : " << kumi::filter<std::is_null_pointer>(original) << "\n";
}
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:32
#include <kumi/kumi.hpp>
#include <type_traits>
#include <iostream>
int main()
{
int a = 4;
double b = 3.1415;
float c = 0.01f;
auto original =
kumi::tuple{a,&a,b,&b,c,&c,
'z',
nullptr};
std::cout << original << "\n";
std::cout << "Pointers : " << kumi::filter<std::is_pointer>(original) << "\n";
std::cout << "Real : " << kumi::filter<std::is_floating_point>(original) << "\n";
std::cout << "nullptr : " << kumi::filter<std::is_null_pointer>(original) << "\n";
}