Loading [MathJax]/extensions/tex2jax.js
kumi
v3.1.0
Exquisite Epidote
•
All
Classes
Namespaces
Functions
Variables
Friends
Modules
Pages
Concepts
Loading...
Searching...
No Matches
◆
partition()
template<
template
<
typename
>
typename
Pred,
kumi::product_type
T>
constexpr
auto
kumi::partition
(
T
&&
tup
)
constexpr
noexcept
Partition a tuple over a predicate.
Template Parameters
Pred
Compile-time predicate
Parameters
tup
Tuple to process
Returns
A tuple containing the tuple of all values which types satisfies
Pred
and the the tuple of all values which types does not satisfy
Pred
.
Helper type
namespace
kumi
{
template
<
template
<
typename
>
typename
Pred
,
kumi::product_type
T
>
struct
partition
;
template
<
template
<
typename
>
typename
Pred
,
kumi::product_type
T
>
using
partition_t =
typename
partition<Pred, T>::type;
}
kumi::product_type
Concept specifying a type follows the Product Type semantic.
Definition
concepts.hpp:33
kumi::partition
constexpr auto partition(T &&tup) noexcept
Partition a tuple over a predicate.
Definition
partition.hpp:37
kumi::from_tuple
constexpr auto from_tuple(tuple< Ts... > const &t)
Converts a kumi::tuple to an instance of an arbitrary type.
Definition
convert.hpp:59
kumi
Main KUMI namespace.
Definition
algorithm.hpp:11
Computes the type returned by a call to
kumi::partition
.
Example:
#include <kumi/tuple.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 first: "
<<
kumi::partition<std::is_pointer>
(
original
) <<
"\n"
;
std::cout <<
"Real first: "
<<
kumi::partition<std::is_floating_point>
(
original
) <<
"\n"
;
std::cout <<
"nullptr first: "
<<
kumi::partition<std::is_null_pointer>
(
original
) <<
"\n"
;
}
kumi::tuple
Fixed-size collection of heterogeneous values.
Definition
tuple.hpp:35
kumi