KUMI v4.0.0
Flawless Fluorite
Loading...
Searching...
No Matches

◆ unique

unique_t kumi::unique {}
inlineconstexprnodiscard

Callable object returning a product type with consecutive duplicate types removed (pairwise uniqueness).

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

Header file

#include <kumi/algorithm/unique.hpp>

Call Signature

template<product_type T>
constexpr auto unique(T && t);
constexpr unique_t unique
Callable object returning a product type with consecutive duplicate types removed (pairwise uniquenes...
Definition unique.hpp:90

Parameters

  • t: Product Type to process

Return value

  • A product type containing elements of t with consecutive duplicates removed.

Helper type

template<kumi::concepts::product_type T> struct unique
{
using type = decltype(kumi::unique(std::declval<T>()));
};
template<kumi::concepts::product_type T> using unique_t = typename kumi::result::unique<T>::type;

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

Examples

Tuple

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
tuple a = {1, 2, 'x', 3, 1.f, 2.f};
std::cout << kumi::unique(a) << "\n";
}
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:33

Record

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
using namespace kumi::literals;
auto a = 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::unique(a) << "\n";
}
Fixed-size collection of heterogeneous tagged fields, tags are unique.
Definition record.hpp:36