KUMI v5.0.0
Gorgeous Garnet
Loading...
Searching...
No Matches

Callable object returning a product type containing the values of the first occurrence of each type in t. More...

Variables

constexpr all_unique_t kumi::all_unique {}

Detailed Description

Callable object returning a product type containing the values of the first occurrence of each type in t.

Variable Documentation

◆ all_unique

all_unique_t kumi::all_unique {}
inlineconstexprnodiscard

On record types, this function operates on the underlying values, not on the fields themselves.

Header file

#include <kumi/kumi.hpp>

Call Signature

namespace kumi
{
template<concepts::product_type T>
constexpr auto all_unique(T && t);
}
constexpr all_unique_t all_unique
Definition unique.hpp:175
Main KUMI namespace.
Definition algorithm.hpp:11

Parameters

  • t: Product Type to process

Return value

  • A product type built by keeping the first occurrence of every distinct element type in t.

Helper type

template<kumi::concepts::product_type T> using all_unique_t = decltype(kumi::all_unique(kumi::declval<T>()));
template<kumi::concepts::product_type T> struct all_unique
{
using type = kumi::result::all_unique_t<T>;
};

Computes the return type of a call to kumi::all_unique

Examples

  • Tuple
    #include <kumi/kumi.hpp>
    #include <iostream>
    int main()
    {
    tuple a = {1, 2, 'x', 3, 1.f, 2.f};
    std::cout << kumi::all_unique(a) << "\n";
    }
    Fixed-size collection of heterogeneous values.
    Definition tuple.hpp:35
  • Record
    #include <kumi/kumi.hpp>
    #include <iostream>
    int main()
    {
    using namespace kumi::literals;
    auto r = kumi::record{"a"_id = 1, "b"_id = 2, "c"_id = 'x', "d"_id = 3, "e"_id = 1.f, "f"_id = 2.f};
    std::cout << kumi::all_unique(r) << "\n";
    }
    Fixed-size collection of heterogeneous fields with distinct labels.
    Definition record.hpp:36