Partition a product type over a predicate.
- Template Parameters
-
| Pred | Compile-time predicate |
- Parameters
-
- Returns
- A tuple containing the product type of all values which types satisfies Pred in t and the product type of all values which types does not satisfy Pred.
On a record type, Pred is applied directly to the underlying elements of the fields.
Helper type
{
template<
template<
typename>
typename Pred, kumi::product_type T>
struct partition;
template<template<typename> typename Pred, kumi::product_type T>
}
constexpr auto partition(T &&t) noexcept
Partition a product type over a predicate.
Definition partition.hpp:70
Main KUMI namespace.
Definition algorithm.hpp:11
Computes the type returned by a call to kumi::partition.
Examples:
Tuple:
#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";
}
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:33
Record:
#include <kumi/kumi.hpp>
#include <type_traits>
#include <iostream>
int main()
{
using namespace kumi::literals;
int a = 4;
double b = 3.1415;
float c = 0.01f;
auto original =
kumi::record{
"a"_id = a,
"b"_id = &a,
"c"_id = b,
"d"_id = &b,
"e"_id = c,
"f"_id = &c,
"g"_id =
'z',
"h"_id =
nullptr};
std::cout << original << "\n";
}
Fixed-size collection of heterogeneous tagged fields, tags are unique.
Definition record.hpp:36